Skip to content

Commit

Permalink
Issue #2312093 by alexpott, yched, andypost, swentel | xjm: Rename Fi…
Browse files Browse the repository at this point in the history
…eldInstanceConfig to FieldConfig.
  • Loading branch information
webchick committed Sep 20, 2014
1 parent 7fa6684 commit 1476c56
Show file tree
Hide file tree
Showing 306 changed files with 2,263 additions and 2,322 deletions.
24 changes: 12 additions & 12 deletions core/config/schema/core.data_types.schema.yml
Expand Up @@ -374,7 +374,7 @@ field_config_base:
type: string
label: 'Default value function'
settings:
type: field.[%parent.field_type].instance_settings
type: field.[%parent.field_type].field_settings
third_party_settings:
type: sequence
label: 'Third party settings'
Expand Down Expand Up @@ -410,7 +410,7 @@ core.date_format.*:

# Schema for the String field type.

field.string.instance_settings:
field.string.field_settings:
type: sequence
label: 'String settings'
sequence:
Expand All @@ -430,7 +430,7 @@ field.string.value:

# Schema for the configuration files of the Boolean field type.

field.boolean.settings:
field.boolean.storage_settings:
type: mapping
label: 'Boolean settings'
mapping:
Expand All @@ -441,7 +441,7 @@ field.boolean.settings:
type: string
label: 'Off label'

field.boolean.instance_settings:
field.boolean.field_settings:
label: 'Boolean settings'
type: mapping
mapping: { }
Expand All @@ -459,13 +459,13 @@ field.boolean.value:

# Schema for the configuration files of the Email field type.

field.email.settings:
field.email.storage_settings:
type: sequence
label: 'Email settings'
sequence:
- type: string

field.email.instance_settings:
field.email.field_settings:
type: sequence
label: 'Email settings'
sequence:
Expand All @@ -485,14 +485,14 @@ field.email.value:

# Schema for configuration files of a numeric field types.

field.integer.settings:
field.integer.storage_settings:
type: sequence
label: 'Integer settings'
sequence:
- type: string
label: 'setting'

field.integer.instance_settings:
field.integer.field_settings:
type: mapping
label: 'Integer'
mapping:
Expand Down Expand Up @@ -520,7 +520,7 @@ field.integer.value:
type: integer
label: 'Value'

field.decimal.settings:
field.decimal.storage_settings:
type: mapping
label: 'Decimal settings'
mapping:
Expand All @@ -531,7 +531,7 @@ field.decimal.settings:
type: integer
label: 'Scale'

field.decimal.instance_settings:
field.decimal.field_settings:
type: mapping
label: 'Decimal'
mapping:
Expand Down Expand Up @@ -559,14 +559,14 @@ field.decimal.value:
type: float
label: 'Value'

field.float.settings:
field.float.storage_settings:
type: sequence
label: 'Float settings'
sequence:
- type: string
label: 'setting'

field.float.instance_settings:
field.float.field_settings:
type: mapping
label: 'Float'
mapping:
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Drupal/Core/Config/ConfigImporter.php
Expand Up @@ -822,7 +822,7 @@ protected function checkOp($collection, $op, $name) {
// result of a secondary configuration write. Change the operation
// into an update. This is the desired behavior since renames often
// have to occur together. For example, renaming a node type must
// also result in renaming its field instances and entity displays.
// also result in renaming its fields and entity displays.
$this->storageComparer->moveRenameToUpdate($name);
return FALSE;
}
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Drupal/Core/Config/ConfigManager.php
Expand Up @@ -215,8 +215,8 @@ public function uninstall($type, $name) {
// dependencies on the to-be-removed entities.
$extension_dependent_entities = $this->findConfigEntityDependentsAsEntities($type, array($name));
// Reverse the array to that entities are removed in the correct order of
// dependence. For example, this ensures that field instances are removed
// before fields.
// dependence. For example, this ensures that fields are removed before
// field storages.
foreach (array_reverse($extension_dependent_entities) as $extension_dependent_entity) {
$extension_dependent_entity->setUninstalling(TRUE);
$extension_dependent_entity->delete();
Expand Down
Expand Up @@ -16,8 +16,8 @@
* Configuration entities can depend on modules, themes and other configuration
* entities. The dependency system is used during configuration installation to
* ensure that configuration entities are imported in the correct order. For
* example, node types are created before their fields and the fields are
* created before their field instances.
* example, node types are created before their field storages and the field
* storages are created before their fields.
*
* Dependencies are stored to the configuration entity's configuration object so
* that they can be checked without the module that provides the configuration
Expand Down
12 changes: 6 additions & 6 deletions core/lib/Drupal/Core/Config/StorageComparer.php
Expand Up @@ -219,8 +219,8 @@ public function createChangelist() {
* Creates the delete changelist.
*
* The list of deletes is sorted so that dependencies are deleted after
* configuration entities that depend on them. For example, field instances
* should be deleted after fields.
* configuration entities that depend on them. For example, fields should be
* deleted after field storages.
*
* @param string $collection
* The storage collection to operate on.
Expand All @@ -234,8 +234,8 @@ protected function addChangelistDelete($collection) {
* Creates the create changelist.
*
* The list of creates is sorted so that dependencies are created before
* configuration entities that depend on them. For example, fields
* should be created before field instances.
* configuration entities that depend on them. For example, field storages
* should be created before fields.
*
* @param string $collection
* The storage collection to operate on.
Expand All @@ -249,8 +249,8 @@ protected function addChangelistCreate($collection) {
* Creates the update changelist.
*
* The list of updates is sorted so that dependencies are created before
* configuration entities that depend on them. For example, fields
* should be updated before field instances.
* configuration entities that depend on them. For example, field storages
* should be updated before fields.
*
* @param string $collection
* The storage collection to operate on.
Expand Down
4 changes: 1 addition & 3 deletions core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Expand Up @@ -10,8 +10,6 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Cache\Cache;
use Drupal\field\FieldInstanceConfigInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

abstract class ContentEntityStorageBase extends EntityStorageBase implements FieldableEntityStorageInterface {
Expand Down Expand Up @@ -137,7 +135,7 @@ public function purgeFieldData(FieldDefinitionInterface $field_definition, $batc
* Reads values to be purged for a single field.
*
* This method is called during field data purge, on fields for which
* onFieldDelete() or onFieldInstanceDelete() has previously run.
* onFieldDelete() or onFieldDelete() has previously run.
*
* @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The field definition.
Expand Down
Expand Up @@ -64,7 +64,7 @@ interface EntityFormDisplayInterface extends EntityDisplayInterface {
* // One sub-array per copy of the widget, keyed by delta.
* 0 => array(
* '#title' => The title to be displayed by the widget,
* '#description' => The description text for the field instance,
* '#description' => The description text for the field,
* '#required' => Whether the widget should be marked required,
* '#delta' => 0,
* '#weight' => 0,
Expand Down
14 changes: 7 additions & 7 deletions core/lib/Drupal/Core/Entity/EntityDisplayBase.php
Expand Up @@ -11,8 +11,8 @@
use Drupal\Core\Config\Entity\ThirdPartySettingsTrait;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Entity\Display\EntityDisplayInterface;
use Drupal\field\Entity\FieldInstanceConfig;
use Drupal\field\FieldInstanceConfigInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\FieldConfigInterface;

/**
* Provides a common base class for entity view and form displays.
Expand Down Expand Up @@ -171,9 +171,9 @@ public function calculateDependencies() {
// Create dependencies on both hidden and visible fields.
$fields = $this->content + $this->hidden;
foreach ($fields as $field_name => $component) {
$field_instance = FieldInstanceConfig::loadByName($this->targetEntityType, $this->bundle, $field_name);
if ($field_instance) {
$this->addDependency('entity', $field_instance->getConfigDependencyName());
$field = FieldConfig::loadByName($this->targetEntityType, $this->bundle, $field_name);
if ($field) {
$this->addDependency('entity', $field->getConfigDependencyName());
}
// Create a dependency on the module that provides the formatter or
// widget.
Expand Down Expand Up @@ -373,7 +373,7 @@ protected function getFieldDefinitions() {
* Determines if a field has options for a given display.
*
* @param FieldDefinitionInterface $definition
* A field instance definition.
* A field definition.
* @return array|null
*/
private function fieldHasDisplayOptions(FieldDefinitionInterface $definition) {
Expand All @@ -388,7 +388,7 @@ private function fieldHasDisplayOptions(FieldDefinitionInterface $definition) {
public function onDependencyRemoval(array $dependencies) {
$changed = FALSE;
foreach ($dependencies['entity'] as $entity) {
if ($entity instanceof FieldInstanceConfigInterface) {
if ($entity instanceof FieldConfigInterface) {
// Remove components for fields that are being deleted.
$this->removeComponent($entity->getName());
unset($this->hidden[$entity->getName()]);
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Drupal/Core/Entity/EntityViewBuilderInterface.php
Expand Up @@ -109,7 +109,7 @@ public function resetCache(array $entities = NULL);
* @param array $display_options
* Can be either:
* - The name of a view mode. The field will be displayed according to the
* display settings specified for this view mode in the $instance
* display settings specified for this view mode in the $field
* definition for the field in the entity's bundle. If no display settings
* are found for the view mode, the settings for the 'default' view mode
* will be used.
Expand Down
Expand Up @@ -1554,7 +1554,7 @@ public function onBundleRename($bundle, $bundle_new) {
// configurable fields, so we use the specific API.
// @todo Use the unified store of deleted field definitions instead in
// https://www.drupal.org/node/2282119
$field_definitions += entity_load_multiple_by_properties('field_instance_config', array('entity_type' => $this->entityTypeId, 'bundle' => $bundle, 'deleted' => TRUE, 'include_deleted' => TRUE));
$field_definitions += entity_load_multiple_by_properties('field_config', array('entity_type' => $this->entityTypeId, 'bundle' => $bundle, 'deleted' => TRUE, 'include_deleted' => TRUE));
$table_mapping = $this->getTableMapping();

foreach ($field_definitions as $field_definition) {
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Drupal/Core/Extension/ModuleHandler.php
Expand Up @@ -939,8 +939,8 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) {
$entity_manager = \Drupal::entityManager();
foreach ($module_list as $module) {

// Clean up all entity bundles (including field instances) of every entity
// type provided by the module that is being uninstalled.
// Clean up all entity bundles (including fields) of every entity type
// provided by the module that is being uninstalled.
foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type->getProvider() == $module) {
foreach (array_keys($entity_manager->getBundleInfo($entity_type_id)) as $bundle) {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Drupal/Core/Field/Annotation/FieldWidget.php
Expand Up @@ -76,7 +76,7 @@ class FieldWidget extends Plugin {

/**
* An integer to determine the weight of this widget relative to other widgets
* in the Field UI when selecting a widget for a given field instance.
* in the Field UI when selecting a widget for a given field.
*
* @var int optional
*/
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Drupal/Core/Field/BaseFieldDefinition.php
Expand Up @@ -62,7 +62,7 @@ public static function create($type) {
// settings for the field type.
// @todo Cleanup in https://drupal.org/node/2116341.
$field_type_manager = \Drupal::service('plugin.manager.field.field_type');
$default_settings = $field_type_manager->getDefaultSettings($type) + $field_type_manager->getDefaultInstanceSettings($type);
$default_settings = $field_type_manager->getDefaultStorageSettings($type) + $field_type_manager->getDefaultFieldSettings($type);
$field_definition->itemDefinition->setSettings($default_settings);
return $field_definition;
}
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php
Expand Up @@ -155,7 +155,7 @@ protected function getBaseFieldDefinition() {
*/
public function preSave(EntityStorageInterface $storage) {
// Set the default instance settings.
$this->settings += \Drupal::service('plugin.manager.field.field_type')->getDefaultInstanceSettings($this->getType());
$this->settings += \Drupal::service('plugin.manager.field.field_type')->getDefaultFieldSettings($this->getType());

// Call the parent's presave method to perform validate and calculate
// dependencies.
Expand Down
18 changes: 9 additions & 9 deletions core/lib/Drupal/Core/Field/FieldConfigBase.php
Expand Up @@ -21,7 +21,7 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn
use ThirdPartySettingsTrait;

/**
* The instance ID.
* The field ID.
*
* The ID consists of 3 parts: the entity type, bundle and the field name.
*
Expand All @@ -32,7 +32,7 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn
public $id;

/**
* The name of the field attached to the bundle by this instance.
* The name of the field attached to the bundle by this field.
*
* @var string
*/
Expand All @@ -52,38 +52,38 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn
public $field_type;

/**
* The name of the entity type the instance is attached to.
* The name of the entity type the field is attached to.
*
* @var string
*/
public $entity_type;

/**
* The name of the bundle the instance is attached to.
* The name of the bundle the field is attached to.
*
* @var string
*/
public $bundle;

/**
* The human-readable label for the instance.
* The human-readable label for the field.
*
* This will be used as the title of Form API elements for the field in entity
* edit forms, or as the label for the field values in displayed entities.
*
* If not specified, this defaults to the field_name (mostly useful for field
* instances created in tests).
* If not specified, this defaults to the field_name (mostly useful for fields
* created in tests).
*
* @var string
*/
public $label;

/**
* The instance description.
* The field description.
*
* A human-readable description for the field when used with this bundle.
* For example, the description will be the help text of Form API elements for
* this instance in entity edit forms.
* this field in entity edit forms.
*
* @var string
*/
Expand Down
6 changes: 3 additions & 3 deletions core/lib/Drupal/Core/Field/FieldConfigInterface.php
Expand Up @@ -18,7 +18,7 @@
* to ensure that implementations have the expected save() method.
*
* @see \Drupal\Core\Field\Entity\BaseFieldOverride
* @see \Drupal\field\Entity\FieldInstanceConfig
* @see \Drupal\field\Entity\FieldConfig
*/
interface FieldConfigInterface extends FieldDefinitionInterface, ConfigEntityInterface, ThirdPartySettingsInterface {

Expand Down Expand Up @@ -52,10 +52,10 @@ public function setTranslatable($translatable);
public function allowBundleRename();

/**
* Returns the name of the bundle this field instance is attached to.
* Returns the name of the bundle this field is attached to.
*
* @return string
* The name of the bundle this field instance is attached to.
* The name of the bundle this field is attached to.
*/
public function targetBundle();

Expand Down
4 changes: 2 additions & 2 deletions core/lib/Drupal/Core/Field/FieldConfigStorageBase.php
Expand Up @@ -28,7 +28,7 @@ abstract class FieldConfigStorageBase extends ConfigEntityStorage {
protected function mapFromStorageRecords(array $records) {
foreach ($records as &$record) {
$class = $this->fieldTypeManager->getPluginClass($record['field_type']);
$record['settings'] = $class::instanceSettingsFromConfigData($record['settings']);
$record['settings'] = $class::fieldSettingsFromConfigData($record['settings']);
}
return parent::mapFromStorageRecords($records);
}
Expand All @@ -39,7 +39,7 @@ protected function mapFromStorageRecords(array $records) {
protected function mapToStorageRecord(EntityInterface $entity) {
$record = parent::mapToStorageRecord($entity);
$class = $this->fieldTypeManager->getPluginClass($record['field_type']);
$record['settings'] = $class::instanceSettingsToConfigData($record['settings']);
$record['settings'] = $class::fieldSettingsFromConfigData($record['settings']);
return $record;
}

Expand Down

0 comments on commit 1476c56

Please sign in to comment.