diff --git a/core/lib/Drupal/Core/Entity/EntityBCDecorator.php b/core/lib/Drupal/Core/Entity/EntityBCDecorator.php index 5f6d481..448d434 100644 --- a/core/lib/Drupal/Core/Entity/EntityBCDecorator.php +++ b/core/lib/Drupal/Core/Entity/EntityBCDecorator.php @@ -124,7 +124,6 @@ public function &__get($name) { $this->decorated->values[$name][Language::LANGCODE_DEFAULT][0]['value'] = NULL; } if (is_array($this->decorated->values[$name][Language::LANGCODE_DEFAULT])) { - // This will work with all defined properties that have a single value. // We need to ensure the key doesn't matter. Mostly it's 'value' but // e.g. EntityReferenceItem uses target_id - so just take the first one. if (isset($this->decorated->values[$name][Language::LANGCODE_DEFAULT][0]) && is_array($this->decorated->values[$name][Language::LANGCODE_DEFAULT][0])) { diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php index ab00b90..4c3e113 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -256,7 +256,7 @@ public function validate(array $form, array &$form_state) { } else { // For BC entities, iterate through each field instance and - // instanciate NG items objects manually. + // instantiate NG items objects manually. $definitions = \Drupal::entityManager()->getFieldDefinitions($entity->entityType(), $entity->bundle()); foreach (field_info_instances($entity->entityType(), $entity->bundle()) as $field_name => $instance) { $langcode = field_is_translatable($entity->entityType(), $instance->getField()) ? $entity_langcode : Language::LANGCODE_NOT_SPECIFIED; diff --git a/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php b/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php index 5aeea36..3dd7983 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php @@ -150,7 +150,7 @@ public function invokeFieldMethod($method, EntityInterface $entity) { } } else { - // For BC entities, iterate through fields and instanciate NG items + // For BC entities, iterate through fields and instantiate NG items // objects manually. $definitions = \Drupal::entityManager()->getFieldDefinitions($entity->entityType(), $entity->bundle()); foreach ($definitions as $field_name => $definition) { @@ -244,7 +244,7 @@ public function invokeFieldItemPrepareCache(EntityInterface $entity) { foreach ($translation->getPropertyDefinitions() as $property => $definition) { $type_definition = \Drupal::typedData()->getDefinition($definition['type']); // Only create the item objects if needed. - if (is_subclass_of($type_definition['class'], '\Drupal\field\Plugin\Type\FieldType\PrepareCacheInterface') + if (is_subclass_of($type_definition['class'], '\Drupal\Core\Entity\Field\PrepareCacheInterface') // Prevent legacy field types from skewing performance too much by // checking the existence of the legacy function directly, instead // of making LegacyConfigFieldItem implement PrepareCacheInterface. @@ -261,14 +261,14 @@ public function invokeFieldItemPrepareCache(EntityInterface $entity) { } } else { - // For BC entities, iterate through the fields and instanciate NG items + // For BC entities, iterate through the fields and instantiate NG items // objects manually. $definitions = \Drupal::entityManager()->getFieldDefinitions($entity->entityType(), $entity->bundle()); foreach ($definitions as $field_name => $definition) { if (!empty($definition['configurable'])) { $type_definition = \Drupal::typedData()->getDefinition($definition['type']); // Only create the item objects if needed. - if (is_subclass_of($type_definition['class'], '\Drupal\field\Plugin\Type\FieldType\PrepareCacheInterface') + if (is_subclass_of($type_definition['class'], '\Drupal\Core\Entity\Field\PrepareCacheInterface') // @todo Remove once all core field types have been converted // (see http://drupal.org/node/2014671). || (is_subclass_of($type_definition['class'], '\Drupal\field\Plugin\field\field_type\LegacyConfigFieldItem') && function_exists($type_definition['module'] . '_field_load'))) { diff --git a/core/lib/Drupal/Core/Entity/Field/PrepareCacheInterface.php b/core/lib/Drupal/Core/Entity/Field/PrepareCacheInterface.php new file mode 100644 index 0000000..5701523 --- /dev/null +++ b/core/lib/Drupal/Core/Entity/Field/PrepareCacheInterface.php @@ -0,0 +1,31 @@ +get('entity')->getValue()) && $entity->isNew()) { return FALSE; } diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigFieldItemInterface.php b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigFieldItemInterface.php index 883e499..1a8a8e0 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigFieldItemInterface.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigFieldItemInterface.php @@ -27,7 +27,7 @@ public function getInstance(); * * This method is static, because the field schema information is needed on * creation of the field. No field instances exist by then, and it is not - * possible to instanciate a FieldItemInterface object yet. + * possible to instantiate a FieldItemInterface object yet. * * @param \Drupal\field\Plugin\Core\Entity\Field $field * The field definition. diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/PrepareCacheInterface.php b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/PrepareCacheInterface.php deleted file mode 100644 index 6aadec1..0000000 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/PrepareCacheInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - 10, ); - // Create an arbitrary entity object, so that we can have an instanciated + // Create an arbitrary entity object, so that we can have an instantiated // FieldItem. $ids = (object) array('entity_type' => $this->instance['entity_type'], 'bundle' => $this->instance['bundle'], 'entity_id' => NULL); $entity = _field_create_entity_from_ids($ids); diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php index f8af209..16ab117 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php @@ -149,7 +149,7 @@ public function validateForm(array &$form, array &$form_state) { $itemsNG = $entity->{$field_name}; } else { - // For BC entities, instanciate NG items objects manually. + // For BC entities, instantiate NG items objects manually. $definitions = \Drupal::entityManager()->getFieldDefinitions($entity->entityType(), $entity->bundle()); $itemsNG = \Drupal::typedData()->create($definitions[$field_name], $items, $field_name, $entity); } diff --git a/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItemBase.php b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItemBase.php index 15edc00..17f2ba3 100644 --- a/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItemBase.php +++ b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItemBase.php @@ -8,7 +8,7 @@ namespace Drupal\text\Plugin\field\field_type; use Drupal\field\Plugin\Type\FieldType\ConfigFieldItemBase; -use Drupal\field\Plugin\Type\FieldType\PrepareCacheInterface; +use Drupal\Core\Entity\Field\PrepareCacheInterface; /** * Base class for 'text' configurable field types. diff --git a/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextWithSummaryItem.php b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextWithSummaryItem.php index 900cf4a..4d9030d 100644 --- a/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextWithSummaryItem.php +++ b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextWithSummaryItem.php @@ -113,7 +113,7 @@ public function getConstraints() { if (!empty($this->getInstance()->getField()->settings['max_length'])) { $max_length = $this->getInstance()->getField()->settings['max_length']; $constraints[] = $constraint_manager->create('ComplexData', array( - 'value' => array( + 'summary' => array( 'Length' => array( 'max' => $max_length, 'maxMessage' => t('%name: the summary may not be longer than @max characters.', array('%name' => $this->getInstance()->label, '@max' => $max_length)),