Commit 1476c56c authored by webchick's avatar webchick

Issue #2312093 by alexpott, yched, andypost, swentel | xjm: Rename...

Issue #2312093 by alexpott, yched, andypost, swentel | xjm: Rename FieldInstanceConfig to FieldConfig.
parent 7fa6684f
...@@ -374,7 +374,7 @@ field_config_base: ...@@ -374,7 +374,7 @@ field_config_base:
type: string type: string
label: 'Default value function' label: 'Default value function'
settings: settings:
type: field.[%parent.field_type].instance_settings type: field.[%parent.field_type].field_settings
third_party_settings: third_party_settings:
type: sequence type: sequence
label: 'Third party settings' label: 'Third party settings'
...@@ -410,7 +410,7 @@ core.date_format.*: ...@@ -410,7 +410,7 @@ core.date_format.*:
# Schema for the String field type. # Schema for the String field type.
field.string.instance_settings: field.string.field_settings:
type: sequence type: sequence
label: 'String settings' label: 'String settings'
sequence: sequence:
...@@ -430,7 +430,7 @@ field.string.value: ...@@ -430,7 +430,7 @@ field.string.value:
# Schema for the configuration files of the Boolean field type. # Schema for the configuration files of the Boolean field type.
field.boolean.settings: field.boolean.storage_settings:
type: mapping type: mapping
label: 'Boolean settings' label: 'Boolean settings'
mapping: mapping:
...@@ -441,7 +441,7 @@ field.boolean.settings: ...@@ -441,7 +441,7 @@ field.boolean.settings:
type: string type: string
label: 'Off label' label: 'Off label'
field.boolean.instance_settings: field.boolean.field_settings:
label: 'Boolean settings' label: 'Boolean settings'
type: mapping type: mapping
mapping: { } mapping: { }
...@@ -459,13 +459,13 @@ field.boolean.value: ...@@ -459,13 +459,13 @@ field.boolean.value:
# Schema for the configuration files of the Email field type. # Schema for the configuration files of the Email field type.
field.email.settings: field.email.storage_settings:
type: sequence type: sequence
label: 'Email settings' label: 'Email settings'
sequence: sequence:
- type: string - type: string
field.email.instance_settings: field.email.field_settings:
type: sequence type: sequence
label: 'Email settings' label: 'Email settings'
sequence: sequence:
...@@ -485,14 +485,14 @@ field.email.value: ...@@ -485,14 +485,14 @@ field.email.value:
# Schema for configuration files of a numeric field types. # Schema for configuration files of a numeric field types.
field.integer.settings: field.integer.storage_settings:
type: sequence type: sequence
label: 'Integer settings' label: 'Integer settings'
sequence: sequence:
- type: string - type: string
label: 'setting' label: 'setting'
field.integer.instance_settings: field.integer.field_settings:
type: mapping type: mapping
label: 'Integer' label: 'Integer'
mapping: mapping:
...@@ -520,7 +520,7 @@ field.integer.value: ...@@ -520,7 +520,7 @@ field.integer.value:
type: integer type: integer
label: 'Value' label: 'Value'
field.decimal.settings: field.decimal.storage_settings:
type: mapping type: mapping
label: 'Decimal settings' label: 'Decimal settings'
mapping: mapping:
...@@ -531,7 +531,7 @@ field.decimal.settings: ...@@ -531,7 +531,7 @@ field.decimal.settings:
type: integer type: integer
label: 'Scale' label: 'Scale'
field.decimal.instance_settings: field.decimal.field_settings:
type: mapping type: mapping
label: 'Decimal' label: 'Decimal'
mapping: mapping:
...@@ -559,14 +559,14 @@ field.decimal.value: ...@@ -559,14 +559,14 @@ field.decimal.value:
type: float type: float
label: 'Value' label: 'Value'
field.float.settings: field.float.storage_settings:
type: sequence type: sequence
label: 'Float settings' label: 'Float settings'
sequence: sequence:
- type: string - type: string
label: 'setting' label: 'setting'
field.float.instance_settings: field.float.field_settings:
type: mapping type: mapping
label: 'Float' label: 'Float'
mapping: mapping:
......
...@@ -822,7 +822,7 @@ protected function checkOp($collection, $op, $name) { ...@@ -822,7 +822,7 @@ protected function checkOp($collection, $op, $name) {
// result of a secondary configuration write. Change the operation // result of a secondary configuration write. Change the operation
// into an update. This is the desired behavior since renames often // into an update. This is the desired behavior since renames often
// have to occur together. For example, renaming a node type must // 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); $this->storageComparer->moveRenameToUpdate($name);
return FALSE; return FALSE;
} }
......
...@@ -215,8 +215,8 @@ public function uninstall($type, $name) { ...@@ -215,8 +215,8 @@ public function uninstall($type, $name) {
// dependencies on the to-be-removed entities. // dependencies on the to-be-removed entities.
$extension_dependent_entities = $this->findConfigEntityDependentsAsEntities($type, array($name)); $extension_dependent_entities = $this->findConfigEntityDependentsAsEntities($type, array($name));
// Reverse the array to that entities are removed in the correct order of // Reverse the array to that entities are removed in the correct order of
// dependence. For example, this ensures that field instances are removed // dependence. For example, this ensures that fields are removed before
// before fields. // field storages.
foreach (array_reverse($extension_dependent_entities) as $extension_dependent_entity) { foreach (array_reverse($extension_dependent_entities) as $extension_dependent_entity) {
$extension_dependent_entity->setUninstalling(TRUE); $extension_dependent_entity->setUninstalling(TRUE);
$extension_dependent_entity->delete(); $extension_dependent_entity->delete();
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
* Configuration entities can depend on modules, themes and other configuration * Configuration entities can depend on modules, themes and other configuration
* entities. The dependency system is used during configuration installation to * entities. The dependency system is used during configuration installation to
* ensure that configuration entities are imported in the correct order. For * ensure that configuration entities are imported in the correct order. For
* example, node types are created before their fields and the fields are * example, node types are created before their field storages and the field
* created before their field instances. * storages are created before their fields.
* *
* Dependencies are stored to the configuration entity's configuration object so * Dependencies are stored to the configuration entity's configuration object so
* that they can be checked without the module that provides the configuration * that they can be checked without the module that provides the configuration
......
...@@ -219,8 +219,8 @@ public function createChangelist() { ...@@ -219,8 +219,8 @@ public function createChangelist() {
* Creates the delete changelist. * Creates the delete changelist.
* *
* The list of deletes is sorted so that dependencies are deleted after * The list of deletes is sorted so that dependencies are deleted after
* configuration entities that depend on them. For example, field instances * configuration entities that depend on them. For example, fields should be
* should be deleted after fields. * deleted after field storages.
* *
* @param string $collection * @param string $collection
* The storage collection to operate on. * The storage collection to operate on.
...@@ -234,8 +234,8 @@ protected function addChangelistDelete($collection) { ...@@ -234,8 +234,8 @@ protected function addChangelistDelete($collection) {
* Creates the create changelist. * Creates the create changelist.
* *
* The list of creates is sorted so that dependencies are created before * The list of creates is sorted so that dependencies are created before
* configuration entities that depend on them. For example, fields * configuration entities that depend on them. For example, field storages
* should be created before field instances. * should be created before fields.
* *
* @param string $collection * @param string $collection
* The storage collection to operate on. * The storage collection to operate on.
...@@ -249,8 +249,8 @@ protected function addChangelistCreate($collection) { ...@@ -249,8 +249,8 @@ protected function addChangelistCreate($collection) {
* Creates the update changelist. * Creates the update changelist.
* *
* The list of updates is sorted so that dependencies are created before * The list of updates is sorted so that dependencies are created before
* configuration entities that depend on them. For example, fields * configuration entities that depend on them. For example, field storages
* should be updated before field instances. * should be updated before fields.
* *
* @param string $collection * @param string $collection
* The storage collection to operate on. * The storage collection to operate on.
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Cache\Cache;
use Drupal\field\FieldInstanceConfigInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class ContentEntityStorageBase extends EntityStorageBase implements FieldableEntityStorageInterface { abstract class ContentEntityStorageBase extends EntityStorageBase implements FieldableEntityStorageInterface {
...@@ -137,7 +135,7 @@ public function purgeFieldData(FieldDefinitionInterface $field_definition, $batc ...@@ -137,7 +135,7 @@ public function purgeFieldData(FieldDefinitionInterface $field_definition, $batc
* Reads values to be purged for a single field. * Reads values to be purged for a single field.
* *
* This method is called during field data purge, on fields for which * 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 * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The field definition. * The field definition.
......
...@@ -64,7 +64,7 @@ interface EntityFormDisplayInterface extends EntityDisplayInterface { ...@@ -64,7 +64,7 @@ interface EntityFormDisplayInterface extends EntityDisplayInterface {
* // One sub-array per copy of the widget, keyed by delta. * // One sub-array per copy of the widget, keyed by delta.
* 0 => array( * 0 => array(
* '#title' => The title to be displayed by the widget, * '#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, * '#required' => Whether the widget should be marked required,
* '#delta' => 0, * '#delta' => 0,
* '#weight' => 0, * '#weight' => 0,
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
use Drupal\Core\Config\Entity\ThirdPartySettingsTrait; use Drupal\Core\Config\Entity\ThirdPartySettingsTrait;
use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Entity\Display\EntityDisplayInterface; use Drupal\Core\Entity\Display\EntityDisplayInterface;
use Drupal\field\Entity\FieldInstanceConfig; use Drupal\field\Entity\FieldConfig;
use Drupal\field\FieldInstanceConfigInterface; use Drupal\field\FieldConfigInterface;
/** /**
* Provides a common base class for entity view and form displays. * Provides a common base class for entity view and form displays.
...@@ -171,9 +171,9 @@ public function calculateDependencies() { ...@@ -171,9 +171,9 @@ public function calculateDependencies() {
// Create dependencies on both hidden and visible fields. // Create dependencies on both hidden and visible fields.
$fields = $this->content + $this->hidden; $fields = $this->content + $this->hidden;
foreach ($fields as $field_name => $component) { foreach ($fields as $field_name => $component) {
$field_instance = FieldInstanceConfig::loadByName($this->targetEntityType, $this->bundle, $field_name); $field = FieldConfig::loadByName($this->targetEntityType, $this->bundle, $field_name);
if ($field_instance) { if ($field) {
$this->addDependency('entity', $field_instance->getConfigDependencyName()); $this->addDependency('entity', $field->getConfigDependencyName());
} }
// Create a dependency on the module that provides the formatter or // Create a dependency on the module that provides the formatter or
// widget. // widget.
...@@ -373,7 +373,7 @@ protected function getFieldDefinitions() { ...@@ -373,7 +373,7 @@ protected function getFieldDefinitions() {
* Determines if a field has options for a given display. * Determines if a field has options for a given display.
* *
* @param FieldDefinitionInterface $definition * @param FieldDefinitionInterface $definition
* A field instance definition. * A field definition.
* @return array|null * @return array|null
*/ */
private function fieldHasDisplayOptions(FieldDefinitionInterface $definition) { private function fieldHasDisplayOptions(FieldDefinitionInterface $definition) {
...@@ -388,7 +388,7 @@ private function fieldHasDisplayOptions(FieldDefinitionInterface $definition) { ...@@ -388,7 +388,7 @@ private function fieldHasDisplayOptions(FieldDefinitionInterface $definition) {
public function onDependencyRemoval(array $dependencies) { public function onDependencyRemoval(array $dependencies) {
$changed = FALSE; $changed = FALSE;
foreach ($dependencies['entity'] as $entity) { foreach ($dependencies['entity'] as $entity) {
if ($entity instanceof FieldInstanceConfigInterface) { if ($entity instanceof FieldConfigInterface) {
// Remove components for fields that are being deleted. // Remove components for fields that are being deleted.
$this->removeComponent($entity->getName()); $this->removeComponent($entity->getName());
unset($this->hidden[$entity->getName()]); unset($this->hidden[$entity->getName()]);
......
...@@ -109,7 +109,7 @@ public function resetCache(array $entities = NULL); ...@@ -109,7 +109,7 @@ public function resetCache(array $entities = NULL);
* @param array $display_options * @param array $display_options
* Can be either: * Can be either:
* - The name of a view mode. The field will be displayed according to the * - 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 * 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 * are found for the view mode, the settings for the 'default' view mode
* will be used. * will be used.
......
...@@ -1554,7 +1554,7 @@ public function onBundleRename($bundle, $bundle_new) { ...@@ -1554,7 +1554,7 @@ public function onBundleRename($bundle, $bundle_new) {
// configurable fields, so we use the specific API. // configurable fields, so we use the specific API.
// @todo Use the unified store of deleted field definitions instead in // @todo Use the unified store of deleted field definitions instead in
// https://www.drupal.org/node/2282119 // 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(); $table_mapping = $this->getTableMapping();
foreach ($field_definitions as $field_definition) { foreach ($field_definitions as $field_definition) {
......
...@@ -939,8 +939,8 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { ...@@ -939,8 +939,8 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) {
$entity_manager = \Drupal::entityManager(); $entity_manager = \Drupal::entityManager();
foreach ($module_list as $module) { foreach ($module_list as $module) {
// Clean up all entity bundles (including field instances) of every entity // Clean up all entity bundles (including fields) of every entity type
// type provided by the module that is being uninstalled. // provided by the module that is being uninstalled.
foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) { foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type->getProvider() == $module) { if ($entity_type->getProvider() == $module) {
foreach (array_keys($entity_manager->getBundleInfo($entity_type_id)) as $bundle) { foreach (array_keys($entity_manager->getBundleInfo($entity_type_id)) as $bundle) {
......
...@@ -76,7 +76,7 @@ class FieldWidget extends Plugin { ...@@ -76,7 +76,7 @@ class FieldWidget extends Plugin {
/** /**
* An integer to determine the weight of this widget relative to other widgets * 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 * @var int optional
*/ */
......
...@@ -62,7 +62,7 @@ public static function create($type) { ...@@ -62,7 +62,7 @@ public static function create($type) {
// settings for the field type. // settings for the field type.
// @todo Cleanup in https://drupal.org/node/2116341. // @todo Cleanup in https://drupal.org/node/2116341.
$field_type_manager = \Drupal::service('plugin.manager.field.field_type'); $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); $field_definition->itemDefinition->setSettings($default_settings);
return $field_definition; return $field_definition;
} }
......
...@@ -155,7 +155,7 @@ protected function getBaseFieldDefinition() { ...@@ -155,7 +155,7 @@ protected function getBaseFieldDefinition() {
*/ */
public function preSave(EntityStorageInterface $storage) { public function preSave(EntityStorageInterface $storage) {
// Set the default instance settings. // 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 // Call the parent's presave method to perform validate and calculate
// dependencies. // dependencies.
......
...@@ -21,7 +21,7 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn ...@@ -21,7 +21,7 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn
use ThirdPartySettingsTrait; use ThirdPartySettingsTrait;
/** /**
* The instance ID. * The field ID.
* *
* The ID consists of 3 parts: the entity type, bundle and the field name. * The ID consists of 3 parts: the entity type, bundle and the field name.
* *
...@@ -32,7 +32,7 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn ...@@ -32,7 +32,7 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn
public $id; 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 * @var string
*/ */
...@@ -52,38 +52,38 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn ...@@ -52,38 +52,38 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn
public $field_type; 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 * @var string
*/ */
public $entity_type; 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 * @var string
*/ */
public $bundle; public $bundle;