Commit 2215dc2e authored by webchick's avatar webchick

Issue #1877632 by fago, jhodgdon: Improve comments and clean-up code for...

Issue #1877632 by fago, jhodgdon: Improve comments and clean-up code for EntityNG and the TypedData API.
parent da31660e
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\Core\Entity\ContentEntityInterface.
* Contains \Drupal\Core\Entity\ContentEntityInterface.
*/
namespace Drupal\Core\Entity;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\Core\Entity\DatabaseStorageController.
* Contains \Drupal\Core\Entity\DatabaseStorageController.
*/
namespace Drupal\Core\Entity;
......@@ -155,7 +155,7 @@ public function __construct($entityType) {
}
/**
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::resetCache().
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::resetCache().
*/
public function resetCache(array $ids = NULL) {
if (isset($ids)) {
......@@ -169,7 +169,7 @@ public function resetCache(array $ids = NULL) {
}
/**
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::load().
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::load().
*/
public function load(array $ids = NULL) {
$entities = array();
......@@ -236,7 +236,7 @@ public function load(array $ids = NULL) {
}
/**
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::loadRevision().
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::loadRevision().
*/
public function loadRevision($revision_id) {
// Build and execute the query.
......@@ -260,7 +260,7 @@ public function loadRevision($revision_id) {
}
/**
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::deleteRevision().
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::deleteRevision().
*/
public function deleteRevision($revision_id) {
if ($revision = $this->loadRevision($revision_id)) {
......@@ -277,7 +277,7 @@ public function deleteRevision($revision_id) {
}
/**
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::loadByProperties().
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::loadByProperties().
*/
public function loadByProperties(array $values = array()) {
// Build a query to fetch the entity IDs.
......@@ -438,7 +438,7 @@ protected function cacheSet($entities) {
}
/**
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::create().
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::create().
*/
public function create(array $values) {
$class = $this->entityInfo['class'];
......@@ -459,7 +459,7 @@ public function create(array $values) {
}
/**
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::delete().
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::delete().
*/
public function delete(array $entities) {
if (!$entities) {
......@@ -503,7 +503,7 @@ public function delete(array $entities) {
}
/**
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::save().
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::save().
*/
public function save(EntityInterface $entity) {
$transaction = db_transaction();
......@@ -666,17 +666,17 @@ protected function invokeHook($hook, EntityInterface $entity) {
}
/**
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::getFieldDefinitions().
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::getFieldDefinitions().
*/
public function getFieldDefinitions(array $constraints) {
// @todo: Add caching for $this->propertyInfo.
// @todo: Add caching for $this->entityFieldInfo.
if (!isset($this->entityFieldInfo)) {
$this->entityFieldInfo = array(
'definitions' => $this->baseFieldDefinitions(),
// Contains definitions of optional (per-bundle) properties.
// Contains definitions of optional (per-bundle) fields.
'optional' => array(),
// An array keyed by bundle name containing the names of the per-bundle
// properties.
// An array keyed by bundle name containing the optional fields added by
// the bundle.
'bundle map' => array(),
);
......@@ -700,12 +700,12 @@ public function getFieldDefinitions(array $constraints) {
$bundle = !empty($constraints['bundle']) ? $constraints['bundle'] : FALSE;
// Add in per-bundle properties.
// Add in per-bundle fields.
if (!isset($this->fieldDefinitions[$bundle])) {
$this->fieldDefinitions[$bundle] = $this->entityFieldInfo['definitions'];
if ($bundle && isset($this->entityFieldInfo['bundle map'][$constraints['bundle']])) {
$this->fieldDefinitions[$bundle] += array_intersect_key($this->entityFieldInfo['optional'], array_flip($this->entityFieldInfo['bundle map'][$constraints['bundle']]));
if ($bundle && isset($this->entityFieldInfo['bundle map'][$bundle])) {
$this->fieldDefinitions[$bundle] += array_intersect_key($this->entityFieldInfo['optional'], array_flip($this->entityFieldInfo['bundle map'][$bundle]));
}
}
return $this->fieldDefinitions[$bundle];
......@@ -721,7 +721,7 @@ public function baseFieldDefinitions() {
}
/**
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::getQueryServiceName().
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::getQueryServiceName().
*/
public function getQueryServiceName() {
return 'entity.query.field_sql_storage';
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\Core\Entity\DatabaseStorageControllerNG.
* Contains \Drupal\Core\Entity\DatabaseStorageControllerNG.
*/
namespace Drupal\Core\Entity;
......@@ -20,6 +20,10 @@
*
* @todo: Once all entity types have been converted, merge improvements into the
* DatabaseStorageController class.
*
* See the EntityNG documentation for an explanation of "NG".
*
* @see \Drupal\Core\EntityNG
*/
class DatabaseStorageControllerNG extends DatabaseStorageController {
......@@ -72,7 +76,7 @@ public function __construct($entityType) {
* the plain value of an entity field, i.e. an array of field items.
* If no numerically indexed array is given, the value will be set for the
* first field item. For example, to set the first item of a 'name'
* property one can pass:
* field one can pass:
* @code
* $values = array('name' => array(0 => array('value' => 'the name')));
* @endcode
......@@ -81,12 +85,13 @@ public function __construct($entityType) {
* $values = array('name' => array('value' => 'the name'));
* @endcode
* If the 'name' field is a defined as 'string_item' which supports
* setting by string value, it's also possible to just pass the name string:
* setting its value by a string, it's also possible to just pass the name
* string:
* @code
* $values = array('name' => 'the name');
* @endcode
*
* @return Drupal\Core\Entity\EntityInterface
* @return \Drupal\Core\Entity\EntityInterface
* A new entity object.
*/
public function create(array $values) {
......@@ -146,13 +151,12 @@ protected function buildPropertyQuery(QueryInterface $entity_query, array $value
* Added mapping from storage records to entities.
*/
protected function attachLoad(&$queried_entities, $load_revision = FALSE) {
// Now map the record values to the according entity properties and
// activate compatibility mode.
// Map the loaded stdclass records into entity objects and according fields.
$queried_entities = $this->mapFromStorageRecords($queried_entities, $load_revision);
// Attach fields.
if ($this->entityInfo['fieldable']) {
// Prepare BC compatible entities for field API.
// Prepare BC compatible entities before passing them to the field API.
$bc_entities = array();
foreach ($queried_entities as $key => $entity) {
$bc_entities[$key] = $entity->getBCEntity();
......@@ -196,7 +200,9 @@ protected function mapFromStorageRecords(array $records, $load_revision = FALSE)
foreach ($records as $id => $record) {
$values = array();
foreach ($record as $name => $value) {
// Avoid unnecessary array hierarchies to save memory.
// Skip the item delta and item value levels but let the field assign
// the value as suiting. This avoids unnecessary array hierarchies and
// saves memory here.
$values[$name][LANGUAGE_DEFAULT] = $value;
}
$bundle = $this->bundleKey ? $record->{$this->bundleKey} : FALSE;
......@@ -296,8 +302,8 @@ public function save(EntityInterface $entity) {
}
else {
$return = drupal_write_record($this->entityInfo['base_table'], $record);
$entity->{$this->idKey}->value = $record->{$this->idKey};
if ($this->revisionKey) {
$entity->{$this->idKey}->value = $record->{$this->idKey};
$record->{$this->revisionKey} = $this->saveRevision($entity);
}
$entity->{$this->idKey}->value = $record->{$this->idKey};
......@@ -312,7 +318,6 @@ public function save(EntityInterface $entity) {
$this->postSave($entity, FALSE);
$this->invokeHook('insert', $entity);
}
$entity->updateOriginalValues();
// Ignore slave server temporarily.
db_ignore_slave();
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\Core\Entity\Entity.
* Contains \Drupal\Core\Entity\Entity.
*/
namespace Drupal\Core\Entity;
......@@ -75,28 +75,28 @@ public function __construct(array $values, $entity_type) {
}
/**
* Implements EntityInterface::id().
* Implements \Drupal\Core\Entity\EntityInterface::id().
*/
public function id() {
return isset($this->id) ? $this->id : NULL;
}
/**
* Implements EntityInterface::uuid().
* Implements \Drupal\Core\Entity\EntityInterface::uuid().
*/
public function uuid() {
return isset($this->uuid) ? $this->uuid : NULL;
}
/**
* Implements EntityInterface::isNew().
* Implements \Drupal\Core\Entity\EntityInterface::isNew().
*/
public function isNew() {
return !empty($this->enforceIsNew) || !$this->id();
}
/**
* Implements EntityInterface::isNewRevision().
* Implements \Drupal\Core\Entity\EntityInterface::isNewRevision().
*/
public function isNewRevision() {
$info = $this->entityInfo();
......@@ -104,35 +104,35 @@ public function isNewRevision() {
}
/**
* Implements EntityInterface::enforceIsNew().
* Implements \Drupal\Core\Entity\EntityInterface::enforceIsNew().
*/
public function enforceIsNew($value = TRUE) {
$this->enforceIsNew = $value;
}
/**
* Implements EntityInterface::setNewRevision().
* Implements \Drupal\Core\Entity\EntityInterface::setNewRevision().
*/
public function setNewRevision($value = TRUE) {
$this->newRevision = $value;
}
/**
* Implements EntityInterface::entityType().
* Implements \Drupal\Core\Entity\EntityInterface::entityType().
*/
public function entityType() {
return $this->entityType;
}
/**
* Implements EntityInterface::bundle().
* Implements \Drupal\Core\Entity\EntityInterface::bundle().
*/
public function bundle() {
return $this->entityType;
}
/**
* Implements EntityInterface::label().
* Implements \Drupal\Core\Entity\EntityInterface::label().
*/
public function label($langcode = NULL) {
$label = NULL;
......@@ -147,7 +147,7 @@ public function label($langcode = NULL) {
}
/**
* Implements EntityInterface::uri().
* Implements \Drupal\Core\Entity\EntityInterface::uri().
*/
public function uri() {
$bundle = $this->bundle();
......@@ -177,7 +177,7 @@ public function uri() {
}
/**
* Implements EntityInterface::get().
* Implements \Drupal\Core\Entity\EntityInterface::get().
*/
public function get($property_name, $langcode = NULL) {
// @todo: Replace by EntityNG implementation once all entity types have been
......@@ -186,7 +186,7 @@ public function get($property_name, $langcode = NULL) {
}
/**
* Implements ComplexDataInterface::set().
* Implements \Drupal\Core\TypedData\ComplexDataInterface::set().
*/
public function set($property_name, $value) {
// @todo: Replace by EntityNG implementation once all entity types have been
......@@ -195,7 +195,7 @@ public function set($property_name, $value) {
}
/**
* Implements ComplexDataInterface::getProperties().
* Implements \Drupal\Core\TypedData\ComplexDataInterface::getProperties().
*/
public function getProperties($include_computed = FALSE) {
// @todo: Replace by EntityNG implementation once all entity types have been
......@@ -203,7 +203,7 @@ public function getProperties($include_computed = FALSE) {
}
/**
* Implements ComplexDataInterface::getPropertyValues().
* Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyValues().
*/
public function getPropertyValues() {
// @todo: Replace by EntityNG implementation once all entity types have been
......@@ -211,7 +211,7 @@ public function getPropertyValues() {
}
/**
* Implements ComplexDataInterface::setPropertyValues().
* Implements \Drupal\Core\TypedData\ComplexDataInterface::setPropertyValues().
*/
public function setPropertyValues($values) {
// @todo: Replace by EntityNG implementation once all entity types have been
......@@ -219,7 +219,7 @@ public function setPropertyValues($values) {
}
/**
* Implements ComplexDataInterface::getPropertyDefinition().
* Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinition().
*/
public function getPropertyDefinition($name) {
// @todo: Replace by EntityNG implementation once all entity types have been
......@@ -227,7 +227,7 @@ public function getPropertyDefinition($name) {
}
/**
* Implements ComplexDataInterface::getPropertyDefinitions().
* Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions().
*/
public function getPropertyDefinitions() {
// @todo: Replace by EntityNG implementation once all entity types have been
......@@ -235,7 +235,7 @@ public function getPropertyDefinitions() {
}
/**
* Implements ComplexDataInterface::isEmpty().
* Implements \Drupal\Core\TypedData\ComplexDataInterface::isEmpty().
*/
public function isEmpty() {
// @todo: Replace by EntityNG implementation once all entity types have been
......@@ -243,7 +243,7 @@ public function isEmpty() {
}
/**
* Implements ComplexDataInterface::getIterator().
* Implements \Drupal\Core\TypedData\ComplexDataInterface::getIterator().
*/
public function getIterator() {
// @todo: Replace by EntityNG implementation once all entity types have been
......@@ -251,7 +251,7 @@ public function getIterator() {
}
/**
* Implements AccessibleInterface::access().
* Implements \Drupal\Core\TypedData\AccessibleInterface::access().
*/
public function access($operation = 'view', \Drupal\user\Plugin\Core\Entity\User $account = NULL) {
$method = $operation . 'Access';
......@@ -261,7 +261,7 @@ public function access($operation = 'view', \Drupal\user\Plugin\Core\Entity\User
}
/**
* Implements TranslatableInterface::language().
* Implements \Drupal\Core\TypedData\TranslatableInterface::language().
*/
public function language() {
// @todo: Replace by EntityNG implementation once all entity types have been
......@@ -275,7 +275,7 @@ public function language() {
}
/**
* Implements TranslatableInterface::getTranslation().
* Implements \Drupal\Core\TypedData\TranslatableInterface::getTranslation().
*/
public function getTranslation($langcode, $strict = TRUE) {
// @todo: Replace by EntityNG implementation once all entity types have been
......@@ -287,14 +287,14 @@ public function getTranslation($langcode, $strict = TRUE) {
*
* @todo: Remove once all entity types implement the entity field API.
* This is deprecated by
* Drupal\Core\TypedData\TranslatableInterface::getTranslationLanguages().
* \Drupal\Core\TypedData\TranslatableInterface::getTranslationLanguages().
*/
public function translations() {
return $this->getTranslationLanguages(FALSE);
}
/**
* Implements TranslatableInterface::getTranslationLanguages().
* Implements \Drupal\Core\TypedData\TranslatableInterface::getTranslationLanguages().
*/
public function getTranslationLanguages($include_default = TRUE) {
// @todo: Replace by EntityNG implementation once all entity types have been
......@@ -325,14 +325,14 @@ public function getTranslationLanguages($include_default = TRUE) {
}
/**
* Implements EntityInterface::save().
* Implements \Drupal\Core\Entity\EntityInterface::save().
*/
public function save() {
return drupal_container()->get('plugin.manager.entity')->getStorageController($this->entityType)->save($this);
}
/**
* Implements EntityInterface::delete().
* Implements \Drupal\Core\Entity\EntityInterface::delete().
*/
public function delete() {
if (!$this->isNew()) {
......@@ -341,7 +341,7 @@ public function delete() {
}
/**
* Implements EntityInterface::createDuplicate().
* Implements \Drupal\Core\Entity\EntityInterface::createDuplicate().
*/
public function createDuplicate() {
$duplicate = clone $this;
......@@ -357,21 +357,21 @@ public function createDuplicate() {
}
/**
* Implements EntityInterface::entityInfo().
* Implements \Drupal\Core\Entity\EntityInterface::entityInfo().
*/
public function entityInfo() {
return entity_get_info($this->entityType);
}
/**
* Implements Drupal\Core\Entity\EntityInterface::getRevisionId().
* Implements \Drupal\Core\Entity\EntityInterface::getRevisionId().
*/
public function getRevisionId() {
return NULL;
}
/**
* Implements Drupal\Core\Entity\EntityInterface::isDefaultRevision().
* Implements \Drupal\Core\Entity\EntityInterface::isDefaultRevision().
*/
public function isDefaultRevision($new_value = NULL) {
$return = $this->isDefaultRevision;
......@@ -382,21 +382,21 @@ public function isDefaultRevision($new_value = NULL) {
}
/**
* Implements Drupal\Core\Entity\EntityInterface::getExportProperties().
* Implements \Drupal\Core\Entity\EntityInterface::getExportProperties().
*/
public function getExportProperties() {
return array();
}
/**
* Implements Drupal\Core\Entity\EntityInterface::getBCEntity().
* Implements \Drupal\Core\Entity\EntityInterface::getBCEntity().
*/
public function getBCEntity() {
return $this;
}
/**
* Implements Drupal\Core\Entity\EntityInterface::getOriginalEntity().
* Implements \Drupal\Core\Entity\EntityInterface::getOriginalEntity().
*/
public function getOriginalEntity() {
return $this;
......@@ -434,7 +434,7 @@ public function getParent() {
* Implements \Drupal\Core\TypedData\ContextAwareInterface::setContext().
*/
public function setContext($name = NULL, ContextAwareInterface $parent = NULL) {
// As entities are always the root of the tree, we do not need to set any
// context.
// As entities are always the root of the tree of typed data, we do not need
// to set any parent or name.
}
}
......@@ -2,7 +2,7 @@
/**
* @file
* Contains Drupal\Core\Entity\EntityAccessController.
* Contains \Drupal\Core\Entity\EntityAccessController.
*/
namespace Drupal\Core\Entity;
......@@ -18,28 +18,28 @@
class EntityAccessController implements EntityAccessControllerInterface {
/**
* Implements EntityAccessControllerInterface::viewAccess().
* Implements \Drupal\Core\Entity\EntityAccessControllerInterface::viewAccess().
*/
public function viewAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAULT, User $account = NULL) {
return FALSE;
}
/**
* Implements EntityAccessControllerInterface::createAccess().
* Implements \Drupal\Core\Entity\EntityAccessControllerInterface::createAccess().
*/
public function createAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAULT, User $account = NULL) {
return FALSE;
}
/**
* Implements EntityAccessControllerInterface::updateAccess().
* Implements \Drupal\Core\Entity\EntityAccessControllerInterface::updateAccess().
*/
public function updateAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAULT, User $account = NULL) {
return FALSE;
}
/**
* Implements EntityAccessControllerInterface::deleteAccess().
* Implements \Drupal\Core\Entity\EntityAccessControllerInterface::deleteAccess().
*/
public function deleteAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAULT, User $account = NULL) {
return FALSE;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains Drupal\Core\Entity\EntityAccessControllerInterface.
* Contains \Drupal\Core\Entity\EntityAccessControllerInterface.
*/
namespace Drupal\Core\Entity;
......
......@@ -12,17 +12,29 @@
use Drupal\Core\TypedData\ContextAwareInterface;
/**
* Implements a decorator providing backwards compatible entity field access.
* Provides backwards compatible (BC) access to entity fields.
*
* Allows using entities converted to the new Entity Field API with the Drupal 7
* way of accessing fields or properties.
* Allows using entities converted to the new Entity Field API with the previous
* way of accessing fields or properties. For example, via the backwards
* compatible (BC) decorator you can do:
* @code
* $node->title = $value;
* $node->body[LANGUAGE_NONE][0]['value'] = $value;
* @endcode
* Without the BC decorator the same assignment would have to look like this:
* @code
* $node->title->value = $value;
* $node->body->value = $value;
* @endcode
* Without the BC decorator the language always default to the entity language,
* whereas a specific translation can be access via the getTranslation() method.
*
* Note: We access the protected 'values' and 'fields' properties of the entity
* via the magic getter - which returns them by reference for us. We do so, as
* providing references to this arrays makes $entity->values and $entity->fields
* to references itself as well, which is problematic during __clone() (this is
* something that would not be easy to fix as an unset() on the variable is
* problematic with the magic getter/setter then).
* The BC decorator should be only used during conversion to the new entity
* field API, such that existing code can be converted iteratively. Any new code
* should directly use the new entity field API and avoid using the
* EntityBCDecorator, if possible.
*
* @todo: Remove once everything is converted to use the new entity field API.
*/
class EntityBCDecorator implements IteratorAggregate, EntityInterface {
......@@ -63,17 +75,31 @@ public function getBCEntity() {
* Directly accesses the plain field values, as done in Drupal 7.
*/
public function &__get($name) {
// Make sure $this->decorated->values reflects the latest values.
// We access the protected 'values' and 'fields' properties of the decorated
// entity via the magic getter - which returns them by reference for us. We
// do so, as providing references to these arrays would make $entity->values
// and $entity->fields reference themselves, which is problematic during
// __clone() (this is something we cannot work-a-round easily as an unset()
// on the variable is problematic in conjunction with the magic
// getter/setter).
if (!empty($this->decorated->fields[$name])) {
// Any field value set via the new Entity Field API will be stored inside
// the field objects managed by the entity, thus we need to ensure
// $this->decorated->values reflects the latest values first.
foreach ($this->decorated->fields[$name] as $langcode => $field) {
$this->decorated->values[$name][$langcode] = $field->getValue();
}
// Values might be changed by reference, so remove the field object to
// avoid them becoming out of sync.
// The returned values might be changed by reference, so we need to remove
// the field object to avoid the field object and the value getting out of
// sync. That way, the next field object instantiated by EntityNG will
// receive the possibly updated value.
unset($this->decorated->fields[$name]);
}
// Allow accessing field values in entity default languages other than
// LANGUAGE_DEFAULT by mapping the values to LANGUAGE_DEFAULT.
// Allow accessing field values in entity default language other than
// LANGUAGE_DEFAULT by mapping the values to LANGUAGE_DEFAULT. This is
// necessary as EntityNG does key values in default language always with
// LANGUAGE_DEFAULT while field API expects them to be keyed by langcode.
$langcode = $this->decorated->language()->langcode;
if ($langcode != LANGUAGE_DEFAULT && isset($this->decorated->values[$name]) && is_array($this->decorated->values[$name])) {
if (isset($this->decorated->values[$name][LANGUAGE_DEFAULT]) && !isset($this->decorated->values[$name][$langcode])) {
......@@ -96,6 +122,9 @@ public function __set($name, $value) {
if (is_array($value) && $definition = $this->decorated->getPropertyDefinition($name)) {
// If field API sets a value with a langcode in entity language, move it
// to LANGUAGE_DEFAULT.
// This is necessary as EntityNG does key values in default language always
// with LANGUAGE_DEFAULT while field API expects them to be keyed by
// langcode.
foreach ($value as $langcode => $data) {
if ($langcode != LANGUAGE_DEFAULT && $langcode == $this->decorated->language()->langcode) {
$value[LANGUAGE_DEFAULT] = $data;
......@@ -104,6 +133,9 @@ public function __set($name, $value) {
}
}
$this->decorated->values[$name] = $value;
// Remove the field object to avoid the field object and the value getting
// out of sync. That way, the next field object instantiated by EntityNG
// will hold the updated value.
unset($this->decorated->fields[$name]);
}
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\Core\Entity\EntityFormController.
* Contains \Drupal\Core\Entity\EntityFormController.
*/
namespace Drupal\Core\Entity;
......@@ -33,7 +33,7 @@ public function __construct($operation) {
}
/**
* Implements Drupal\Core\Entity\EntityFormControllerInterface::build().
* Implements \Drupal\Core\Entity\EntityFormControllerInterface::build().
*/
public function build(array $form, array &$form_state, EntityInterface $entity) {
......@@ -151,7 +151,7 @@ protected function actions(array $form, array &$form_state) {
}
/**
* Implements Drupal\Core\Entity\EntityFormControllerInterface::validate().
* Implements \Drupal\Core\Entity\EntityFormControllerInterface::validate().
*/
public function validate(array $form, array &$form_state) {
// @todo Exploit the Field API to validate the values submitted for the
......@@ -170,7 +170,7 @@ public function validate(array $form, array &$form_state) {
}
/**
* Implements Drupal\Core\Entity\EntityFormControllerInterface::submit().
* Implements \Drupal\Core\Entity\EntityFormControllerInterface::submit().
*
* This is the default entity object builder function. It is called before any
* other submit handler to build the new entity object to be passed to the
......@@ -219,7 +219,7 @@ public function delete(array $form, array &$form_state) {
}
/**
* Implements Drupal\Core\Entity\EntityFormControllerInterface::getFormLangcode().
* Implements \Drupal\Core\Entity\EntityFormControllerInterface::getFormLangcode().
*/
public function getFormLangcode(array $form_state) {
$entity = $this->getEntity($form_state);
......@@ -245,7 +245,7 @@ public function getFormLangcode(array $form_state) {
}
/**
* Implements EntityFormControllerInterface::isDefaultFormLangcode().
* Implements \Drupal\Core\Entity\EntityFormControllerInterface::isDefaultFormLangcode().
*/
public function isDefaultFormLangcode(array $form_state) {
return $this->getFormLangcode($form_state) == $this->getEntity($form_state)->language()->langcode;
......@@ -301,7 +301,7 @@ protected function submitEntityLanguage(array $form, array &$form_state) {
}
/**
* Implements Drupal\Core\Entity\EntityFormControllerInterface::buildEntity().
* Implements \Drupal\Core\Entity\EntityFormControllerInterface::buildEntity().
*/