diff --git a/core/includes/config.inc b/core/includes/config.inc index 954c470ee612a07d92ffdbbd1f1327b08f01016f..8c3ded308fbe485b55be8d9438ab170ff4f24dec 100644 --- a/core/includes/config.inc +++ b/core/includes/config.inc @@ -79,8 +79,8 @@ function config($name) { * Either the entity type name, or NULL if none match. */ function config_get_entity_type_by_name($name) { - $entities = array_filter(\Drupal::entityManager()->getDefinitions(), function (EntityTypeInterface $entity_info) use ($name) { - return ($config_prefix = $entity_info->getConfigPrefix()) && strpos($name, $config_prefix . '.') === 0; + $entities = array_filter(\Drupal::entityManager()->getDefinitions(), function (EntityTypeInterface $entity_type) use ($name) { + return ($config_prefix = $entity_type->getConfigPrefix()) && strpos($name, $config_prefix . '.') === 0; }); return key($entities); } diff --git a/core/includes/entity.inc b/core/includes/entity.inc index adaf57d3e730f25d621bcf4f48d1bf977d0c0f74..eeb117b4f6d1ff1e21b3d2adf47b2f29f05ed9dd 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -250,7 +250,7 @@ function entity_revision_delete($entity_type, $revision_id) { * * Note that some entity types may not support UUIDs. * - * @param string $entity_type + * @param string $entity_type_id * The entity type to load; e.g., 'node' or 'user'. * @param string $uuid * The UUID of the entity to load. @@ -265,13 +265,13 @@ function entity_revision_delete($entity_type, $revision_id) { * * @see \Drupal\Core\Entity\EntityManagerInterface */ -function entity_load_by_uuid($entity_type, $uuid, $reset = FALSE) { - $entity_info = \Drupal::entityManager()->getDefinition($entity_type); - if (!$uuid_key = $entity_info->getKey('uuid')) { - throw new EntityStorageException("Entity type $entity_type does not support UUIDs."); +function entity_load_by_uuid($entity_type_id, $uuid, $reset = FALSE) { + $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); + if (!$uuid_key = $entity_type->getKey('uuid')) { + throw new EntityStorageException("Entity type $entity_type_id does not support UUIDs."); } - $controller = \Drupal::entityManager()->getStorageController($entity_type); + $controller = \Drupal::entityManager()->getStorageController($entity_type_id); if ($reset) { $controller->resetCache(); } diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php index 2d27e2e958352ac74e544a485cfb877cd2913b24..8b1aa45056f37fc667057ef647a1d8618364b822 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php @@ -82,8 +82,8 @@ class ConfigStorageController extends EntityStorageControllerBase implements Con /** * Constructs a ConfigStorageController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Config\ConfigFactory $config_factory * The config factory service. * @param \Drupal\Core\Config\StorageInterface $config_storage @@ -93,8 +93,8 @@ class ConfigStorageController extends EntityStorageControllerBase implements Con * @param \Drupal\Component\Uuid\UuidInterface $uuid_service * The UUID service. */ - public function __construct(EntityTypeInterface $entity_info, ConfigFactory $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, UuidInterface $uuid_service) { - parent::__construct($entity_info); + public function __construct(EntityTypeInterface $entity_type, ConfigFactory $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, UuidInterface $uuid_service) { + parent::__construct($entity_type); $this->idKey = $this->entityType->getKey('id'); $this->statusKey = $this->entityType->getKey('status'); @@ -108,9 +108,9 @@ public function __construct(EntityTypeInterface $entity_info, ConfigFactory $con /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('config.factory'), $container->get('config.storage'), $container->get('entity.query'), diff --git a/core/lib/Drupal/Core/Config/Entity/DraggableListController.php b/core/lib/Drupal/Core/Config/Entity/DraggableListController.php index d057bc9e8d2d136ccd0df073b70064de65f34cda..f2c3ff883ed72deeb4f606ddb167bfe09e396ded 100644 --- a/core/lib/Drupal/Core/Config/Entity/DraggableListController.php +++ b/core/lib/Drupal/Core/Config/Entity/DraggableListController.php @@ -48,8 +48,8 @@ abstract class DraggableListController extends ConfigEntityListController implem /** * {@inheritdoc} */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage) { + parent::__construct($entity_type, $storage); // Check if the entity type supports weighting. if ($this->entityType->hasKey('weight')) { diff --git a/core/lib/Drupal/Core/Config/Entity/Query/Query.php b/core/lib/Drupal/Core/Config/Entity/Query/Query.php index 40144edd55076bdfd7ac6b1fe46110765491cb1f..36c6c50566a1f0a3663d3e3d6846265da8060824 100644 --- a/core/lib/Drupal/Core/Config/Entity/Query/Query.php +++ b/core/lib/Drupal/Core/Config/Entity/Query/Query.php @@ -124,15 +124,15 @@ public function execute() { * Config records keyed by entity IDs. */ protected function loadRecords() { - $entity_info = $this->entityManager->getDefinition($this->getEntityType()); - $prefix = $entity_info->getConfigPrefix() . '.'; + $entity_type = $this->entityManager->getDefinition($this->getEntityType()); + $prefix = $entity_type->getConfigPrefix() . '.'; $prefix_length = strlen($prefix); // Search the conditions for restrictions on entity IDs. $ids = array(); if ($this->condition->getConjunction() == 'AND') { foreach ($this->condition->conditions() as $condition) { - if (is_string($condition['field']) && $condition['field'] == $entity_info->getKey('id')) { + if (is_string($condition['field']) && $condition['field'] == $entity_type->getKey('id')) { $operator = $condition['operator'] ?: (is_array($condition['value']) ? 'IN' : '='); if ($operator == '=') { $ids = array($condition['value']); diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 61481aff7612c2983cd66a02bab2b35ebefa1343..15721293624d3e2d8de957bbc333f014ac696176 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -720,8 +720,8 @@ public function addTranslation($langcode, array $values = array()) { // Instantiate a new empty entity so default values will be populated in the // specified language. - $info = $this->getEntityType(); - $default_values = array($info->getKey('bundle') => $this->bundle, 'langcode' => $langcode); + $entity_type = $this->getEntityType(); + $default_values = array($entity_type->getKey('bundle') => $this->bundle, 'langcode' => $langcode); $entity = \Drupal::entityManager() ->getStorageController($this->getEntityTypeId()) ->create($default_values); @@ -906,18 +906,18 @@ public function createDuplicate() { } $duplicate = clone $this; - $entity_info = $this->getEntityType(); - $duplicate->{$entity_info->getKey('id')}->value = NULL; + $entity_type = $this->getEntityType(); + $duplicate->{$entity_type->getKey('id')}->value = NULL; // Check if the entity type supports UUIDs and generate a new one if so. - if ($entity_info->hasKey('uuid')) { + if ($entity_type->hasKey('uuid')) { // @todo Inject the UUID service into the Entity class once possible. - $duplicate->{$entity_info->getKey('uuid')}->value = \Drupal::service('uuid')->generate(); + $duplicate->{$entity_type->getKey('uuid')}->value = \Drupal::service('uuid')->generate(); } // Check whether the entity type supports revisions and initialize it if so. - if ($entity_info->hasKey('revision')) { - $duplicate->{$entity_info->getKey('revision')}->value = NULL; + if ($entity_type->hasKey('revision')) { + $duplicate->{$entity_type->getKey('revision')}->value = NULL; } return $duplicate; @@ -959,12 +959,12 @@ public function __clone() { */ public function label() { $label = NULL; - $entity_info = $this->getEntityType(); + $entity_type = $this->getEntityType(); // @todo Convert to is_callable() and call_user_func(). - if (($label_callback = $entity_info->getLabelCallback()) && function_exists($label_callback)) { + if (($label_callback = $entity_type->getLabelCallback()) && function_exists($label_callback)) { $label = $label_callback($this); } - elseif (($label_key = $entity_info->getKey('label')) && isset($this->{$label_key})) { + elseif (($label_key = $entity_type->getKey('label')) && isset($this->{$label_key})) { $label = $this->{$label_key}->value; } return $label; diff --git a/core/lib/Drupal/Core/Entity/ContentEntityFormController.php b/core/lib/Drupal/Core/Entity/ContentEntityFormController.php index 509d10fe5949673e9e7bedd69794808d706bce88..cad25116009585e4b53b0175fb5c7b2e3511ee3c 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityFormController.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityFormController.php @@ -130,15 +130,15 @@ public function isDefaultFormLangcode(array $form_state) { */ public function buildEntity(array $form, array &$form_state) { $entity = clone $this->entity; - $entity_type = $entity->getEntityTypeId(); - $info = \Drupal::entityManager()->getDefinition($entity_type); + $entity_type_id = $entity->getEntityTypeId(); + $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); // @todo Exploit the Entity Field API to process the submitted field values. // Copy top-level form values that are entity fields but not handled by // field API without changing existing entity fields that are not being // edited by this form. Values of fields handled by field API are copied // by field_attach_extract_form_values() below. - $values_excluding_fields = $info->isFieldable() ? array_diff_key($form_state['values'], field_info_instances($entity_type, $entity->bundle())) : $form_state['values']; + $values_excluding_fields = $entity_type->isFieldable() ? array_diff_key($form_state['values'], field_info_instances($entity_type_id, $entity->bundle())) : $form_state['values']; $definitions = $entity->getPropertyDefinitions(); foreach ($values_excluding_fields as $key => $value) { if (isset($definitions[$key])) { @@ -149,12 +149,12 @@ public function buildEntity(array $form, array &$form_state) { // Invoke all specified builders for copying form values to entity fields. if (isset($form['#entity_builders'])) { foreach ($form['#entity_builders'] as $function) { - call_user_func_array($function, array($entity_type, $entity, &$form, &$form_state)); + call_user_func_array($function, array($entity_type_id, $entity, &$form, &$form_state)); } } // Invoke field API for copying field values. - if ($info->isFieldable()) { + if ($entity_type->isFieldable()) { field_attach_extract_form_values($entity, $form, $form_state, array('langcode' => $this->getFormLangcode($form_state))); } return $entity; diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php index b8abf2fa8493bb1ccd78381f4e3571a0ad0dddd0..7dfedbcd1287cca1726cd1c3225a424f8f663ea3 100644 --- a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php @@ -38,8 +38,6 @@ class DatabaseStorageController extends EntityStorageControllerBase { /** * Whether this entity type should use the static cache. * - * Set by entity info. - * * @var boolean */ protected $cache; @@ -61,9 +59,9 @@ class DatabaseStorageController extends EntityStorageControllerBase { /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('database'), $container->get('uuid') ); @@ -72,15 +70,15 @@ public static function createInstance(ContainerInterface $container, EntityTypeI /** * Constructs a DatabaseStorageController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Database\Connection $database * The database connection to be used. * @param \Drupal\Component\Uuid\UuidInterface $uuid_service * The UUID service. */ - public function __construct(EntityTypeInterface $entity_info, Connection $database, UuidInterface $uuid_service) { - parent::__construct($entity_info); + public function __construct(EntityTypeInterface $entity_type, Connection $database, UuidInterface $uuid_service) { + parent::__construct($entity_type); $this->database = $database; $this->uuidService = $uuid_service; diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index 573d2d89b4ca148215f5c84f906610d0e07019eb..5d7051026d5127efd1583df973d6b45b29bf9c33 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -107,12 +107,12 @@ public function bundle() { */ public function label() { $label = NULL; - $entity_info = $this->getEntityType(); + $entity_type = $this->getEntityType(); // @todo Convert to is_callable() and call_user_func(). - if (($label_callback = $entity_info->getLabelCallback()) && function_exists($label_callback)) { + if (($label_callback = $entity_type->getLabelCallback()) && function_exists($label_callback)) { $label = $label_callback($this); } - elseif (($label_key = $entity_info->getKey('label')) && isset($this->{$label_key})) { + elseif (($label_key = $entity_type->getKey('label')) && isset($this->{$label_key})) { $label = $this->{$label_key}; } return $label; @@ -291,13 +291,13 @@ public function delete() { */ public function createDuplicate() { $duplicate = clone $this; - $entity_info = $this->getEntityType(); - $duplicate->{$entity_info->getKey('id')} = NULL; + $entity_type = $this->getEntityType(); + $duplicate->{$entity_type->getKey('id')} = NULL; // Check if the entity type supports UUIDs and generate a new one if so. - if ($entity_info->hasKey('uuid')) { + if ($entity_type->hasKey('uuid')) { // @todo Inject the UUID service into the Entity class once possible. - $duplicate->{$entity_info->getKey('uuid')} = \Drupal::service('uuid')->generate(); + $duplicate->{$entity_type->getKey('uuid')} = \Drupal::service('uuid')->generate(); } return $duplicate; } diff --git a/core/lib/Drupal/Core/Entity/EntityAccessController.php b/core/lib/Drupal/Core/Entity/EntityAccessController.php index 4873292942bbc6b01827c7153a12481e978aa3ed..835bb5a22596c548c6c8474fe9fcc0fe87091911 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessController.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessController.php @@ -43,12 +43,12 @@ class EntityAccessController extends EntityControllerBase implements EntityAcces /** * Constructs an access controller instance. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. */ - public function __construct(EntityTypeInterface $entity_info) { - $this->entityTypeId = $entity_info->id(); - $this->entityType = $entity_info; + public function __construct(EntityTypeInterface $entity_type) { + $this->entityTypeId = $entity_type->id(); + $this->entityType = $entity_type; } /** diff --git a/core/lib/Drupal/Core/Entity/EntityControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityControllerInterface.php index cdcffd35da72b403b2709ccd651bba856bcbd8f0..a9bf653c5adf2f1d748aa1d53dbd5d8c14e6b7a3 100644 --- a/core/lib/Drupal/Core/Entity/EntityControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityControllerInterface.php @@ -31,12 +31,12 @@ interface EntityControllerInterface { * * @param \Symfony\Component\DependencyInjection\ContainerInterface $container * The service container this object should use. - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * * @return static * A new instance of the entity controller. */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info); + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type); } diff --git a/core/lib/Drupal/Core/Entity/EntityListController.php b/core/lib/Drupal/Core/Entity/EntityListController.php index c56b2291e806962c0db40e7170a3a4e807b34191..0703f5026ef8f1582a94368dd280b898fc308f06 100644 --- a/core/lib/Drupal/Core/Entity/EntityListController.php +++ b/core/lib/Drupal/Core/Entity/EntityListController.php @@ -41,25 +41,25 @@ class EntityListController extends EntityControllerBase implements EntityListCon /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, - $container->get('entity.manager')->getStorageController($entity_info->id()) + $entity_type, + $container->get('entity.manager')->getStorageController($entity_type->id()) ); } /** * Constructs a new EntityListController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The entity storage controller class. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage) { - $this->entityTypeId = $entity_info->id(); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage) { + $this->entityTypeId = $entity_type->id(); $this->storage = $storage; - $this->entityType = $entity_info; + $this->entityType = $entity_type; } /** diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index c68645d3d07f4ed229a8c06b144652a4a14b75d3..b3579b8bf49b3532eb9ead71b9722c68b2c7286d 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -282,12 +282,12 @@ public function getController($entity_type, $controller_type, $controller_class_ /** * {@inheritdoc} */ - public function getAdminRouteInfo($entity_type, $bundle) { - if (($entity_info = $this->getDefinition($entity_type)) && $admin_form = $entity_info->getLinkTemplate('admin-form')) { + public function getAdminRouteInfo($entity_type_id, $bundle) { + if (($entity_type = $this->getDefinition($entity_type_id)) && $admin_form = $entity_type->getLinkTemplate('admin-form')) { return array( 'route_name' => $admin_form, 'route_parameters' => array( - $entity_info->getBundleEntityType() => $bundle, + $entity_type->getBundleEntityType() => $bundle, ), ); } @@ -296,21 +296,21 @@ public function getAdminRouteInfo($entity_type, $bundle) { /** * {@inheritdoc} */ - public function getFieldDefinitions($entity_type, $bundle = NULL) { - if (!isset($this->entityFieldInfo[$entity_type])) { + public function getFieldDefinitions($entity_type_id, $bundle = NULL) { + if (!isset($this->entityFieldInfo[$entity_type_id])) { // First, try to load from cache. - $cid = 'entity_field_definitions:' . $entity_type . ':' . $this->languageManager->getCurrentLanguage()->id; + $cid = 'entity_field_definitions:' . $entity_type_id . ':' . $this->languageManager->getCurrentLanguage()->id; if ($cache = $this->cache->get($cid)) { - $this->entityFieldInfo[$entity_type] = $cache->data; + $this->entityFieldInfo[$entity_type_id] = $cache->data; } else { // @todo: Refactor to allow for per-bundle overrides. // See https://drupal.org/node/2114707. - $entity_info = $this->getDefinition($entity_type); - $class = $entity_info->getClass(); + $entity_type = $this->getDefinition($entity_type_id); + $class = $entity_type->getClass(); - $this->entityFieldInfo[$entity_type] = array( - 'definitions' => $class::baseFieldDefinitions($entity_type), + $this->entityFieldInfo[$entity_type_id] = array( + 'definitions' => $class::baseFieldDefinitions($entity_type_id), // Contains definitions of optional (per-bundle) fields. 'optional' => array(), // An array keyed by bundle name containing the optional fields added @@ -319,14 +319,14 @@ public function getFieldDefinitions($entity_type, $bundle = NULL) { ); // Invoke hooks. - $result = $this->moduleHandler->invokeAll($entity_type . '_field_info'); - $this->entityFieldInfo[$entity_type] = NestedArray::mergeDeep($this->entityFieldInfo[$entity_type], $result); - $result = $this->moduleHandler->invokeAll('entity_field_info', array($entity_type)); - $this->entityFieldInfo[$entity_type] = NestedArray::mergeDeep($this->entityFieldInfo[$entity_type], $result); + $result = $this->moduleHandler->invokeAll($entity_type_id . '_field_info'); + $this->entityFieldInfo[$entity_type_id] = NestedArray::mergeDeep($this->entityFieldInfo[$entity_type_id], $result); + $result = $this->moduleHandler->invokeAll('entity_field_info', array($entity_type_id)); + $this->entityFieldInfo[$entity_type_id] = NestedArray::mergeDeep($this->entityFieldInfo[$entity_type_id], $result); // Automatically set the field name for non-configurable fields. foreach (array('definitions', 'optional') as $key) { - foreach ($this->entityFieldInfo[$entity_type][$key] as $field_name => &$definition) { + foreach ($this->entityFieldInfo[$entity_type_id][$key] as $field_name => &$definition) { if ($definition instanceof FieldDefinition) { $definition->setName($field_name); } @@ -334,36 +334,36 @@ public function getFieldDefinitions($entity_type, $bundle = NULL) { } // Invoke alter hooks. - $hooks = array('entity_field_info', $entity_type . '_field_info'); - $this->moduleHandler->alter($hooks, $this->entityFieldInfo[$entity_type], $entity_type); + $hooks = array('entity_field_info', $entity_type_id . '_field_info'); + $this->moduleHandler->alter($hooks, $this->entityFieldInfo[$entity_type_id], $entity_type_id); // Ensure all basic fields are not defined as translatable. - $keys = array_intersect_key(array_filter($entity_info->getKeys()), array_flip(array('id', 'revision', 'uuid', 'bundle'))); + $keys = array_intersect_key(array_filter($entity_type->getKeys()), array_flip(array('id', 'revision', 'uuid', 'bundle'))); $untranslatable_fields = array_flip(array('langcode') + $keys); foreach (array('definitions', 'optional') as $key) { - foreach ($this->entityFieldInfo[$entity_type][$key] as $field_name => &$definition) { + foreach ($this->entityFieldInfo[$entity_type_id][$key] as $field_name => &$definition) { if (isset($untranslatable_fields[$field_name]) && $definition->isTranslatable()) { throw new \LogicException(String::format('The @field field cannot be translatable.', array('@field' => $definition->getLabel()))); } } } - $this->cache->set($cid, $this->entityFieldInfo[$entity_type], Cache::PERMANENT, array('entity_info' => TRUE, 'entity_field_info' => TRUE)); + $this->cache->set($cid, $this->entityFieldInfo[$entity_type_id], Cache::PERMANENT, array('entity_info' => TRUE, 'entity_field_info' => TRUE)); } } if (!$bundle) { - return $this->entityFieldInfo[$entity_type]['definitions']; + return $this->entityFieldInfo[$entity_type_id]['definitions']; } else { // Add in per-bundle fields. - if (!isset($this->fieldDefinitions[$entity_type][$bundle])) { - $this->fieldDefinitions[$entity_type][$bundle] = $this->entityFieldInfo[$entity_type]['definitions']; - if (isset($this->entityFieldInfo[$entity_type]['bundle map'][$bundle])) { - $this->fieldDefinitions[$entity_type][$bundle] += array_intersect_key($this->entityFieldInfo[$entity_type]['optional'], array_flip($this->entityFieldInfo[$entity_type]['bundle map'][$bundle])); + if (!isset($this->fieldDefinitions[$entity_type_id][$bundle])) { + $this->fieldDefinitions[$entity_type_id][$bundle] = $this->entityFieldInfo[$entity_type_id]['definitions']; + if (isset($this->entityFieldInfo[$entity_type_id]['bundle map'][$bundle])) { + $this->fieldDefinitions[$entity_type_id][$bundle] += array_intersect_key($this->entityFieldInfo[$entity_type_id]['optional'], array_flip($this->entityFieldInfo[$entity_type_id]['bundle map'][$bundle])); } } - return $this->fieldDefinitions[$entity_type][$bundle]; + return $this->fieldDefinitions[$entity_type_id][$bundle]; } } @@ -404,9 +404,9 @@ public function getAllBundleInfo() { else { $this->bundleInfo = $this->moduleHandler->invokeAll('entity_bundle_info'); // If no bundles are provided, use the entity type name and label. - foreach ($this->getDefinitions() as $type => $entity_info) { + foreach ($this->getDefinitions() as $type => $entity_type) { if (!isset($this->bundleInfo[$type])) { - $this->bundleInfo[$type][$type]['label'] = $entity_info->getLabel(); + $this->bundleInfo[$type][$type]['label'] = $entity_type->getLabel(); } } $this->moduleHandler->alter('entity_bundle_info', $this->bundleInfo); diff --git a/core/lib/Drupal/Core/Entity/EntityManagerInterface.php b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php index b68fde8fcca907ae30a9678d2ba9aabb875b9d39..3dde8e974a5f4534649d28d84dfd3436a484cf2d 100644 --- a/core/lib/Drupal/Core/Entity/EntityManagerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php @@ -27,7 +27,7 @@ public function getEntityTypeLabels(); * * If a bundle is passed, fields specific to this bundle are included. * - * @param string $entity_type + * @param string $entity_type_id * The entity type to get field definitions for. Only entity types that * implement \Drupal\Core\Entity\ContentEntityInterface are supported. * @param string $bundle @@ -40,7 +40,7 @@ public function getEntityTypeLabels(); * @see \Drupal\Core\TypedData\TypedDataManager::create() * @see \Drupal\Core\Entity\EntityManager::getFieldDefinitionsByConstraints() */ - public function getFieldDefinitions($entity_type, $bundle = NULL); + public function getFieldDefinitions($entity_type_id, $bundle = NULL); /** * Creates a new access controller instance. @@ -56,7 +56,7 @@ public function getAccessController($entity_type); /** * Returns the route information for an entity type's bundle. * - * @param string $entity_type + * @param string $entity_type_id * The entity type. * @param string $bundle * The name of the bundle. @@ -67,7 +67,7 @@ public function getAccessController($entity_type); * - route_parameters: (optional) An associative array of parameter names * and values. */ - public function getAdminRouteInfo($entity_type, $bundle); + public function getAdminRouteInfo($entity_type_id, $bundle); /** * Gets an array of entity field definitions based on validation constraints. diff --git a/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php b/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php index 5427501886ac46e869bdd1424ce71760b368eeef..5416935aed6ad671ae0b5f7db658aae3424c2d27 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php @@ -61,12 +61,12 @@ abstract class EntityStorageControllerBase extends EntityControllerBase implemen /** * Constructs an EntityStorageControllerBase instance. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. */ - public function __construct(EntityTypeInterface $entity_info) { - $this->entityTypeId = $entity_info->id(); - $this->entityType = $entity_info; + public function __construct(EntityTypeInterface $entity_type) { + $this->entityTypeId = $entity_type->id(); + $this->entityType = $entity_type; // Check if the entity type supports static caching of loaded entities. $this->cache = $this->entityType->isStaticallyCacheable(); } diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php index 395b7079ed195257e8d07d643c01c83891089858..05646ba7321828e19aa1c01b87de2abdd2c0814f 100644 --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -60,16 +60,16 @@ class EntityViewBuilder extends EntityControllerBase implements EntityController /** * Constructs a new EntityViewBuilder. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity information array. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager service. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. */ - public function __construct(EntityTypeInterface $entity_info, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager) { - $this->entityTypeId = $entity_info->id(); - $this->entityType = $entity_info; + public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager) { + $this->entityTypeId = $entity_type->id(); + $this->entityType = $entity_type; $this->entityManager = $entity_manager; $this->languageManager = $language_manager; } @@ -77,9 +77,9 @@ public function __construct(EntityTypeInterface $entity_info, EntityManagerInter /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('entity.manager'), $container->get('language_manager') ); diff --git a/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php b/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php index 99d17a515ccfe23dc2d61adf4b84ac4bce9bee00..33cef2df6dfc7a3442ec7e36a4a930f31a179dd0 100644 --- a/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php @@ -63,8 +63,6 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle /** * Whether this entity type should use the static cache. * - * Set by entity info. - * * @var boolean */ protected $cache; @@ -86,9 +84,9 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('database'), $container->get('field.info') ); @@ -97,15 +95,15 @@ public static function createInstance(ContainerInterface $container, EntityTypeI /** * Constructs a DatabaseStorageController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Database\Connection $database * The database connection to be used. * @param \Drupal\field\FieldInfo $field_info * The field info service. */ - public function __construct(EntityTypeInterface $entity_info, Connection $database, FieldInfo $field_info) { - parent::__construct($entity_info); + public function __construct(EntityTypeInterface $entity_type, Connection $database, FieldInfo $field_info) { + parent::__construct($entity_type); $this->database = $database; $this->fieldInfo = $field_info; @@ -1187,13 +1185,13 @@ public static function _fieldSqlSchema(FieldInterface $field, array $schema = NU $description_revision = "Revision archive storage for {$field->entity_type} field {$field->getName()}."; } - $entity_type = $field->entity_type; + $entity_type_id = $field->entity_type; $entity_manager = \Drupal::entityManager(); - $info = $entity_manager->getDefinition($entity_type); - $definitions = $entity_manager->getFieldDefinitions($entity_type); + $entity_type = $entity_manager->getDefinition($entity_type_id); + $definitions = $entity_manager->getFieldDefinitions($entity_type_id); // Define the entity ID schema based on the field definitions. - $id_definition = $definitions[$info->getKey('id')]; + $id_definition = $definitions[$entity_type->getKey('id')]; if ($id_definition->getType() == 'integer') { $id_schema = array( 'type' => 'int', @@ -1213,7 +1211,7 @@ public static function _fieldSqlSchema(FieldInterface $field, array $schema = NU // Define the revision ID schema, default to integer if there is no revision // ID. - $revision_id_definition = $info->hasKey('revision_id') ? $definitions[$info->getKey('revision_id')] : NULL; + $revision_id_definition = $entity_type->hasKey('revision_id') ? $definitions[$entity_type->getKey('revision_id')] : NULL; if (!$revision_id_definition || $revision_id_definition->getType() == 'integer') { $revision_id_schema = array( 'type' => 'int', diff --git a/core/lib/Drupal/Core/Entity/FieldableEntityStorageControllerBase.php b/core/lib/Drupal/Core/Entity/FieldableEntityStorageControllerBase.php index 143837bc26d1a1407a49a01dc7de95e39ab92822..22b54a3a6aef25e4a7569ba7d3df02033db4dc85 100644 --- a/core/lib/Drupal/Core/Entity/FieldableEntityStorageControllerBase.php +++ b/core/lib/Drupal/Core/Entity/FieldableEntityStorageControllerBase.php @@ -33,11 +33,11 @@ abstract class FieldableEntityStorageControllerBase extends EntityStorageControl /** * Constructs a FieldableEntityStorageControllerBase object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. */ - public function __construct(EntityTypeInterface $entity_info) { - parent::__construct($entity_info); + public function __construct(EntityTypeInterface $entity_type) { + parent::__construct($entity_type); $this->bundleKey = $this->entityType->getKey('bundle'); $this->entityClass = $this->entityType->getClass(); @@ -46,9 +46,9 @@ public function __construct(EntityTypeInterface $entity_info) { /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info + $entity_type ); } @@ -205,8 +205,8 @@ protected function saveFieldItems(EntityInterface $entity, $update = TRUE) { $this->doSaveFieldItems($entity, $update); if ($update) { - $entity_info = $entity->getEntityType(); - if ($entity_info->isFieldDataCacheable()) { + $entity_type = $entity->getEntityType(); + if ($entity_type->isFieldDataCacheable()) { cache('field')->delete('field:' . $entity->getEntityTypeId() . ':' . $entity->id()); } } @@ -225,8 +225,8 @@ protected function saveFieldItems(EntityInterface $entity, $update = TRUE) { protected function deleteFieldItems(EntityInterface $entity) { $this->doDeleteFieldItems($entity); - $entity_info = $entity->getEntityType(); - if ($entity_info->isFieldDataCacheable()) { + $entity_type = $entity->getEntityType(); + if ($entity_type->isFieldDataCacheable()) { cache('field')->delete('field:' . $entity->getEntityTypeId() . ':' . $entity->id()); } } diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php index 508959c8d42d574715117af1acf2282eaaed94e7..f5a9aa49a3c4ca12783d7a8bce4b0b2fde7b2d9e 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php @@ -80,21 +80,21 @@ public function getDerivativeDefinitions(array $base_plugin_definition) { // Also keep the 'entity' defined as is. $this->derivatives[''] = $base_plugin_definition; // Add definitions for each entity type and bundle. - foreach ($this->entityManager->getDefinitions() as $entity_type => $info) { - $this->derivatives[$entity_type] = array( - 'label' => $info->getLabel(), - 'class' => $info->getClass(), - 'constraints' => array('EntityType' => $entity_type), + foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { + $this->derivatives[$entity_type_id] = array( + 'label' => $entity_type->getLabel(), + 'class' => $entity_type->getClass(), + 'constraints' => array('EntityType' => $entity_type_id), ) + $base_plugin_definition; // Incorporate the bundles as entity:$entity_type:$bundle, if any. - foreach (entity_get_bundles($entity_type) as $bundle => $bundle_info) { - if ($bundle !== $entity_type) { - $this->derivatives[$entity_type . ':' . $bundle] = array( + foreach (entity_get_bundles($entity_type_id) as $bundle => $bundle_info) { + if ($bundle !== $entity_type_id) { + $this->derivatives[$entity_type_id . ':' . $bundle] = array( 'label' => $bundle_info['label'], - 'class' => $info->getClass(), + 'class' => $entity_type->getClass(), 'constraints' => array( - 'EntityType' => $entity_type, + 'EntityType' => $entity_type_id, 'Bundle' => $bundle, ), ) + $base_plugin_definition; diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Query.php b/core/lib/Drupal/Core/Entity/Query/Sql/Query.php index 3fdf76472f1841803798c10bf9a55f3d39760c37..7d7d901c5db049b7c4a17d98c23f5eb7d8cfa90f 100644 --- a/core/lib/Drupal/Core/Entity/Query/Sql/Query.php +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Query.php @@ -20,7 +20,7 @@ class Query extends QueryBase implements QueryInterface { /** - * Contains the entity info for the entity type of that query. + * The entity type definition. * * @var \Drupal\Core\Entity\EntityTypeInterface */ @@ -71,7 +71,7 @@ class Query extends QueryBase implements QueryInterface { * @param string $entity_type * The entity type. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager storing the entity info. + * The entity manager service. * @param string $conjunction * - AND: all of the conditions on the query need to match. * - OR: at least one of the conditions on the query need to match. diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php index 9f2848ba1ddcacf9ef651869d2e28fc363698f24..add9c7342d6833ac45bcc19033571334aba99b5b 100644 --- a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php @@ -56,7 +56,7 @@ public function __construct(SelectInterface $sql_query) { * {@inheritdoc} */ public function addField($field, $type, $langcode) { - $entity_type = $this->sqlQuery->getMetaData('entity_type'); + $entity_type_id = $this->sqlQuery->getMetaData('entity_type'); $entity_manager = \Drupal::entityManager(); $field_info = FieldInfo::fieldInfo(); $age = $this->sqlQuery->getMetaData('age'); @@ -74,7 +74,7 @@ public function addField($field, $type, $langcode) { // This will contain the definitions of the last specifier seen by the // system. $propertyDefinitions = array(); - $entity_info = $entity_manager->getDefinition($entity_type); + $entity_type = $entity_manager->getDefinition($entity_type_id); // Use the lightweight and fast field map for checking whether a specifier // is a field or not. While calling field_info_field() on every specifier // delivers the same information, if no specifiers are using the field API @@ -83,7 +83,7 @@ public function addField($field, $type, $langcode) { for ($key = 0; $key <= $count; $key ++) { // If there is revision support and only the current revision is being // queried then use the revision id. Otherwise, the entity id will do. - if (($revision_key = $entity_info->getKey('revision')) && $age == EntityStorageControllerInterface::FIELD_LOAD_CURRENT) { + if (($revision_key = $entity_type->getKey('revision')) && $age == EntityStorageControllerInterface::FIELD_LOAD_CURRENT) { // This contains the relevant SQL field to be used when joining entity // tables. $entity_id_field = $revision_key; @@ -92,7 +92,7 @@ public function addField($field, $type, $langcode) { $field_id_field = 'revision_id'; } else { - $entity_id_field = $entity_info->getKey('id'); + $entity_id_field = $entity_type->getKey('id'); $field_id_field = 'entity_id'; } // This can either be the name of an entity property (non-configurable @@ -104,8 +104,8 @@ public function addField($field, $type, $langcode) { if (substr($specifier, 0, 3) == 'id:') { $field = $field_info->getFieldById((substr($specifier, 3))); } - elseif (isset($field_map[$entity_type][$specifier])) { - $field = $field_info->getField($entity_type, $specifier); + elseif (isset($field_map[$entity_type_id][$specifier])) { + $field = $field_info->getField($entity_type_id, $specifier); } else { $field = FALSE; @@ -138,11 +138,11 @@ public function addField($field, $type, $langcode) { $values = array(); $field_name = $field->getName(); // If there are bundles, pick one. - if ($bundle_key = $entity_info->getKey('bundle')) { - $values[$bundle_key] = reset($field_map[$entity_type][$field_name]['bundles']); + if ($bundle_key = $entity_type->getKey('bundle')) { + $values[$bundle_key] = reset($field_map[$entity_type_id][$field_name]['bundles']); } $entity = $entity_manager - ->getStorageController($entity_type) + ->getStorageController($entity_type_id) ->create($values); $propertyDefinitions = $entity->$field_name->getPropertyDefinitions(); @@ -172,11 +172,11 @@ public function addField($field, $type, $langcode) { // finds the property first. The data table is preferred, which is why // it gets added before the base table. $entity_tables = array(); - if ($data_table = $entity_info->getDataTable()) { + if ($data_table = $entity_type->getDataTable()) { $this->sqlQuery->addMetaData('simple_query', FALSE); $entity_tables[$data_table] = drupal_get_schema($data_table); } - $entity_base_table = $entity_info->getBaseTable(); + $entity_base_table = $entity_type->getBaseTable(); $entity_tables[$entity_base_table] = drupal_get_schema($entity_base_table); $sql_column = $specifier; $table = $this->ensureEntityTable($index_prefix, $specifier, $type, $langcode, $base_table, $entity_id_field, $entity_tables); @@ -191,12 +191,12 @@ public function addField($field, $type, $langcode) { $values = array(); // If there are bundles, pick one. It does not matter which, // properties exist on all bundles. - if ($bundle_key = $entity_info->getKey('bundle')) { - $bundles = entity_get_bundles($entity_type); + if ($bundle_key = $entity_type->getKey('bundle')) { + $bundles = entity_get_bundles($entity_type_id); $values[$bundle_key] = key($bundles); } $entity = $entity_manager - ->getStorageController($entity_type) + ->getStorageController($entity_type_id) ->create($values); $propertyDefinitions = $entity->$specifier->getPropertyDefinitions(); $relationship_specifier = $specifiers[$key + 1]; @@ -205,11 +205,11 @@ public function addField($field, $type, $langcode) { // Check for a valid relationship. if (isset($propertyDefinitions[$relationship_specifier]) && $entity->get($specifier)->first()->get('entity') instanceof EntityReference) { // If it is, use the entity type. - $entity_type = $propertyDefinitions[$relationship_specifier]->getConstraint('EntityType'); - $entity_info = $entity_manager->getDefinition($entity_type); + $entity_type_id = $propertyDefinitions[$relationship_specifier]->getConstraint('EntityType'); + $entity_type = $entity_manager->getDefinition($entity_type_id); // Add the new entity base table using the table and sql column. - $join_condition= '%alias.' . $entity_info->getKey('id') . " = $table.$sql_column"; - $base_table = $this->sqlQuery->leftJoin($entity_info->getBaseTable(), NULL, $join_condition); + $join_condition= '%alias.' . $entity_type->getKey('id') . " = $table.$sql_column"; + $base_table = $this->sqlQuery->leftJoin($entity_type->getBaseTable(), NULL, $join_condition); $propertyDefinitions = array(); $key++; $index_prefix .= "$next_index_prefix."; diff --git a/core/modules/action/lib/Drupal/action/ActionListController.php b/core/modules/action/lib/Drupal/action/ActionListController.php index ee612c98d483148b4ed7ebfb58541bd6f3501a6a..946bcca11116cf761a9de7288713aa08d3f39f6f 100644 --- a/core/modules/action/lib/Drupal/action/ActionListController.php +++ b/core/modules/action/lib/Drupal/action/ActionListController.php @@ -35,15 +35,15 @@ class ActionListController extends ConfigEntityListController implements EntityC /** * Constructs a new ActionListController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The action storage controller. * @param \Drupal\Core\Action\ActionManager $action_manager * The action plugin manager. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, ActionManager $action_manager) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage, ActionManager $action_manager) { + parent::__construct($entity_type, $storage); $this->actionManager = $action_manager; } @@ -51,10 +51,10 @@ public function __construct(EntityTypeInterface $entity_info, EntityStorageContr /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, - $container->get('entity.manager')->getStorageController($entity_info->id()), + $entity_type, + $container->get('entity.manager')->getStorageController($entity_type->id()), $container->get('plugin.manager.action') ); } diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php index c8f85ed3f8542ed38a81be92ebe45c0c9e2bfaad..39b7053e40d1f36e7e81f866a7c4d32105acca4f 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php @@ -48,7 +48,7 @@ public static function getInfo() { * Overrides \Drupal\simpletest\WebTestBase::setUp(). */ public function setUp() { - $this->entityType = 'custom_block'; + $this->entityTypeId = 'custom_block'; $this->bundle = 'basic'; $this->name = drupal_strtolower($this->randomName()); $this->testLanguageSelector = FALSE; diff --git a/core/modules/block/lib/Drupal/block/BlockAccessController.php b/core/modules/block/lib/Drupal/block/BlockAccessController.php index 6e2c1a512d5578f6139d15b6502a497481b18a24..9469ffcb4a05c34f032a91999dcd40ee28853552 100644 --- a/core/modules/block/lib/Drupal/block/BlockAccessController.php +++ b/core/modules/block/lib/Drupal/block/BlockAccessController.php @@ -31,22 +31,22 @@ class BlockAccessController extends EntityAccessController implements EntityCont /** * Constructs a BlockAccessController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager * The alias manager. */ - public function __construct(EntityTypeInterface $entity_info, AliasManagerInterface $alias_manager) { - parent::__construct($entity_info); + public function __construct(EntityTypeInterface $entity_type, AliasManagerInterface $alias_manager) { + parent::__construct($entity_type); $this->aliasManager = $alias_manager; } /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('path.alias_manager') ); } diff --git a/core/modules/block/lib/Drupal/block/BlockListController.php b/core/modules/block/lib/Drupal/block/BlockListController.php index 11503ede04b5742de8b47535d5f6c1ba048c18c5..b2105747fadc32c179a75591ee082533c2d869a3 100644 --- a/core/modules/block/lib/Drupal/block/BlockListController.php +++ b/core/modules/block/lib/Drupal/block/BlockListController.php @@ -56,15 +56,15 @@ class BlockListController extends ConfigEntityListController implements FormInte /** * Constructs a new BlockListController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The entity storage controller class. * @param \Drupal\Component\Plugin\PluginManagerInterface $block_manager * The block manager. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, PluginManagerInterface $block_manager) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage, PluginManagerInterface $block_manager) { + parent::__construct($entity_type, $storage); $this->blockManager = $block_manager; } @@ -72,10 +72,10 @@ public function __construct(EntityTypeInterface $entity_info, EntityStorageContr /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, - $container->get('entity.manager')->getStorageController($entity_info->id()), + $entity_type, + $container->get('entity.manager')->getStorageController($entity_type->id()), $container->get('plugin.manager.block') ); } diff --git a/core/modules/breakpoint/breakpoint.module b/core/modules/breakpoint/breakpoint.module index 5b995270ef6f61967db4246fca66777c24b96c7f..6c606ec94bbf661c24b7f85e10ee5045b181a719 100644 --- a/core/modules/breakpoint/breakpoint.module +++ b/core/modules/breakpoint/breakpoint.module @@ -81,11 +81,11 @@ function breakpoint_modules_uninstalled($modules) { function _breakpoint_delete_breakpoints($list, $source_type) { $ids = config_get_storage_names_with_prefix('breakpoint.breakpoint_group.' . $source_type . '.'); $entity_manager = \Drupal::entityManager(); - $entity_info = $entity_manager->getDefinition('breakpoint_group'); + $entity_type = $entity_manager->getDefinition('breakpoint_group'); // Remove the breakpoint.breakpoint part of the breakpoint identifier. foreach ($ids as &$id) { - $id = ConfigStorageController::getIDFromConfigName($id, $entity_info->getConfigPrefix()); + $id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix()); } $breakpoint_groups = entity_load_multiple('breakpoint_group', $ids); @@ -96,11 +96,11 @@ function _breakpoint_delete_breakpoints($list, $source_type) { // Get all breakpoints defined by this theme/module. $breakpoint_ids = \Drupal::service('config.storage')->listAll('breakpoint.breakpoint.' . $source_type . '.' . $breakpoint_group->id() . '.'); - $entity_info = $entity_manager->getDefinition('breakpoint'); + $entity_type = $entity_manager->getDefinition('breakpoint'); // Remove the breakpoint.breakpoint part of the breakpoint identifier. foreach ($breakpoint_ids as &$breakpoint_id) { - $breakpoint_id = ConfigStorageController::getIDFromConfigName($breakpoint_id, $entity_info->getConfigPrefix()); + $breakpoint_id = ConfigStorageController::getIDFromConfigName($breakpoint_id, $entity_type->getConfigPrefix()); } $breakpoints = entity_load_multiple('breakpoint', $breakpoint_ids); diff --git a/core/modules/comment/comment.views.inc b/core/modules/comment/comment.views.inc index ac80d13e0921118b9fc5ebd4812d117be2a04178..760f24e45614918dd3004ca3d1115e4e2c4c48b3 100644 --- a/core/modules/comment/comment.views.inc +++ b/core/modules/comment/comment.views.inc @@ -349,23 +349,23 @@ function comment_views_data() { ), ); - $entities_info = \Drupal::entityManager()->getDefinitions(); + $entities_types = \Drupal::entityManager()->getDefinitions(); // Provide a relationship for each entity type except comment. - foreach ($entities_info as $type => $entity_info) { - if ($type == 'comment' || !$entity_info->isFieldable() || !$entity_info->getBaseTable()) { + foreach ($entities_types as $type => $entity_type) { + if ($type == 'comment' || !$entity_type->isFieldable() || !$entity_type->getBaseTable()) { continue; } if ($fields = \Drupal::service('comment.manager')->getFields($type)) { $data['comment'][$type] = array( 'relationship' => array( - 'title' => $entity_info->getLabel(), - 'help' => t('The @entity_type to which the comment is a reply to.', array('@entity_type' => $entity_info->getLabel())), - 'base' => $entity_info->getBaseTable(), - 'base field' => $entity_info->getKey('id'), + 'title' => $entity_type->getLabel(), + 'help' => t('The @entity_type to which the comment is a reply to.', array('@entity_type' => $entity_type->getLabel())), + 'base' => $entity_type->getBaseTable(), + 'base field' => $entity_type->getKey('id'), 'relationship field' => 'entity_id', 'id' => 'standard', - 'label' => $entity_info->getLabel(), + 'label' => $entity_type->getLabel(), 'extra' => array( array( 'field' => 'entity_type', @@ -431,8 +431,8 @@ function comment_views_data() { $data['comment_entity_statistics']['table']['group'] = t('Comment Statistics'); // Provide a relationship for each entity type except comment. - foreach ($entities_info as $type => $entity_info) { - if ($type == 'comment' || !$entity_info->isFieldable() || !$entity_info->getBaseTable()) { + foreach ($entities_types as $type => $entity_type) { + if ($type == 'comment' || !$entity_type->isFieldable() || !$entity_type->getBaseTable()) { continue; } // This relationship does not use the 'field id' column, if the entity has @@ -442,9 +442,9 @@ function comment_views_data() { // {comment_entity_statistics} for each field as multiple joins between // the same two tables is not supported. if (\Drupal::service('comment.manager')->getFields($type)) { - $data['comment_entity_statistics']['table']['join'][$entity_info->getBaseTable()] = array( + $data['comment_entity_statistics']['table']['join'][$entity_type->getBaseTable()] = array( 'type' => 'INNER', - 'left_field' => $entity_info->getKey('id'), + 'left_field' => $entity_type->getKey('id'), 'field' => 'entity_id', 'extra' => array( array( diff --git a/core/modules/comment/lib/Drupal/comment/CommentManager.php b/core/modules/comment/lib/Drupal/comment/CommentManager.php index debd1eb7ec19f88c6f25c62757f418ecad494924..b4d4e3fae7e0ddc3e1df248c5afccc3ba7f91e45 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentManager.php +++ b/core/modules/comment/lib/Drupal/comment/CommentManager.php @@ -108,14 +108,14 @@ public function getParentEntityUri(CommentInterface $comment) { /** * {@inheritdoc} */ - public function getFields($entity_type) { - $info = $this->entityManager->getDefinition($entity_type); - if (!$info->isSubclassOf('\Drupal\Core\Entity\ContentEntityInterface')) { + public function getFields($entity_type_id) { + $entity_type = $this->entityManager->getDefinition($entity_type_id); + if (!$entity_type->isSubclassOf('\Drupal\Core\Entity\ContentEntityInterface')) { return array(); } $map = $this->getAllFields(); - return isset($map[$entity_type]) ? $map[$entity_type] : array(); + return isset($map[$entity_type_id]) ? $map[$entity_type_id] : array(); } /** diff --git a/core/modules/comment/lib/Drupal/comment/CommentManagerInterface.php b/core/modules/comment/lib/Drupal/comment/CommentManagerInterface.php index 8226e235b2bd8832f7062d1eb1f99bff88ead1ad..b6024e9b067f0b75997c5bd077e3bdc10cdbbf19 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentManagerInterface.php +++ b/core/modules/comment/lib/Drupal/comment/CommentManagerInterface.php @@ -27,7 +27,7 @@ public function getParentEntityUri(CommentInterface $comment); /** * Utility function to return an array of comment fields. * - * @param string $entity_type + * @param string $entity_type_id * The content entity type to which the comment fields are attached. * * @return array @@ -39,7 +39,7 @@ public function getParentEntityUri(CommentInterface $comment); * * @see field_info_field_map() */ - public function getFields($entity_type); + public function getFields($entity_type_id); /** * Utility function to return all comment fields. diff --git a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php index 53d0ad7f046e037273ad61805bfa1c8d78d6d95f..8612170569aacb8150d14293137b156758050ae6 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php +++ b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php @@ -46,9 +46,9 @@ class CommentViewBuilder extends EntityViewBuilder { /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('entity.manager'), $container->get('language_manager'), $container->get('field.info'), @@ -59,8 +59,8 @@ public static function createInstance(ContainerInterface $container, EntityTypeI /** * Constructs a new CommentViewBuilder. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity information array. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager service. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager @@ -70,8 +70,8 @@ public static function createInstance(ContainerInterface $container, EntityTypeI * @param \Drupal\Core\Access\CsrfTokenGenerator $csrf_token * The CSRF token manager service. */ - public function __construct(EntityTypeInterface $entity_info, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, FieldInfo $field_info, CsrfTokenGenerator $csrf_token) { - parent::__construct($entity_info, $entity_manager, $language_manager); + public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, FieldInfo $field_info, CsrfTokenGenerator $csrf_token) { + parent::__construct($entity_type, $entity_manager, $language_manager); $this->fieldInfo = $field_info; $this->csrfToken = $csrf_token; } diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php index c664fe288b59c863903947842e7103c457d1cfb9..2e9226d2362d9ce9807135c029da11b74ad081f0 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php @@ -35,7 +35,7 @@ public static function getInfo() { } function setUp() { - $this->entityType = 'comment'; + $this->entityTypeId = 'comment'; $this->nodeBundle = 'article'; $this->bundle = 'node__comment_article'; $this->testLanguageSelector = FALSE; @@ -128,7 +128,7 @@ protected function getNewEntityValues($langcode) { */ protected function assertPublishedStatus() { parent::assertPublishedStatus(); - $entity = entity_load($this->entityType, $this->entityId); + $entity = entity_load($this->entityTypeId, $this->entityId); $user = $this->drupalCreateUser(array('access comments')); $this->drupalLogin($user); $languages = language_list(); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityUnitTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityUnitTest.php index 817a7d0bd6c040db90dabfe824734c7841e9555f..df6c96dba0eead295943c15fee6097fabd09895f 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityUnitTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityUnitTest.php @@ -49,16 +49,16 @@ protected function setUp() { * Tests storage controller methods. */ public function testStorageControllerMethods() { - $info = \Drupal::entityManager()->getDefinition('config_test'); + $entity_type = \Drupal::entityManager()->getDefinition('config_test'); - $expected = $info->getConfigPrefix() . '.'; + $expected = $entity_type->getConfigPrefix() . '.'; $this->assertIdentical($this->storage->getConfigPrefix(), $expected); // Test the static extractID() method. $expected_id = 'test_id'; - $config_name = $info->getConfigPrefix() . '.' . $expected_id; + $config_name = $entity_type->getConfigPrefix() . '.' . $expected_id; $storage = $this->storage; - $this->assertIdentical($storage::getIDFromConfigName($config_name, $info->getConfigPrefix()), $expected_id); + $this->assertIdentical($storage::getIDFromConfigName($config_name, $entity_type->getConfigPrefix()), $expected_id); // Create three entities, two with the same style. $style = $this->randomName(8); diff --git a/core/modules/config_translation/config_translation.api.php b/core/modules/config_translation/config_translation.api.php index c9e66565bc2d20429d503271db152f308d71856d..03a502c6b535a52d6859a2bc913c08ab45f42168 100644 --- a/core/modules/config_translation/config_translation.api.php +++ b/core/modules/config_translation/config_translation.api.php @@ -39,23 +39,23 @@ function hook_config_translation_info(&$info) { // "field_ui.instance_edit_$entity_type" are not defined. if (\Drupal::moduleHandler()->moduleExists('field_ui')) { // Add fields entity mappers to all fieldable entity types defined. - foreach ($entity_manager->getDefinitions() as $entity_type => $entity_info) { + foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) { $base_route = NULL; try { - $base_route = $route_provider->getRouteByName('field_ui.instance_edit_' . $entity_type); + $base_route = $route_provider->getRouteByName('field_ui.instance_edit_' . $entity_type_id); } catch (RouteNotFoundException $e) { // Ignore non-existent routes. } // Make sure entity type is fieldable and has a base route. - if ($entity_info->isFieldable() && !empty($base_route)) { - $info[$entity_type . '_fields'] = array( - 'base_route_name' => 'field_ui.instance_edit_' . $entity_type, + if ($entity_type->isFieldable() && !empty($base_route)) { + $info[$entity_type_id . '_fields'] = array( + 'base_route_name' => 'field_ui.instance_edit_' . $entity_type_id, 'entity_type' => 'field_instance', 'title' => t('!label field'), 'class' => '\Drupal\config_translation\ConfigFieldInstanceMapper', - 'base_entity_type' => $entity_type, + 'base_entity_type' => $entity_type_id, 'weight' => 10, ); } diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module index e3f1ac9a3d273a14c89cee76e8bf631b2d42379a..558841a3067c99f2815c4967ac1b0b003c960c8f 100644 --- a/core/modules/config_translation/config_translation.module +++ b/core/modules/config_translation/config_translation.module @@ -114,23 +114,23 @@ function config_translation_config_translation_info(&$info) { // "field_ui.instance_edit_$entity_type" are not defined. if (\Drupal::moduleHandler()->moduleExists('field_ui')) { // Add fields entity mappers to all fieldable entity types defined. - foreach ($entity_manager->getDefinitions() as $entity_type => $entity_info) { + foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) { $base_route = NULL; try { - $base_route = $route_provider->getRouteByName('field_ui.instance_edit_' . $entity_type); + $base_route = $route_provider->getRouteByName('field_ui.instance_edit_' . $entity_type_id); } catch (RouteNotFoundException $e) { // Ignore non-existent routes. } // Make sure entity type is fieldable and has a base route. - if ($entity_info->isFieldable() && !empty($base_route)) { - $info[$entity_type . '_fields'] = array( - 'base_route_name' => 'field_ui.instance_edit_' . $entity_type, + if ($entity_type->isFieldable() && !empty($base_route)) { + $info[$entity_type_id . '_fields'] = array( + 'base_route_name' => 'field_ui.instance_edit_' . $entity_type_id, 'entity_type' => 'field_instance', 'title' => '!label field', 'class' => '\Drupal\config_translation\ConfigFieldInstanceMapper', - 'base_entity_type' => $entity_type, + 'base_entity_type' => $entity_type_id, 'weight' => 10, ); } @@ -138,12 +138,12 @@ function config_translation_config_translation_info(&$info) { } // Discover configuration entities automatically. - foreach ($entity_manager->getDefinitions() as $entity_type => $entity_info) { + foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) { // Determine base path for entities automatically if provided via the // configuration entity. if ( - !$entity_info->isSubclassOf('Drupal\Core\Config\Entity\ConfigEntityInterface') || - !$entity_info->hasLinkTemplate('edit-form') + !$entity_type->isSubclassOf('Drupal\Core\Config\Entity\ConfigEntityInterface') || + !$entity_type->hasLinkTemplate('edit-form') ) { // Do not record this entity mapper if the entity type does not // provide a base route. We'll surely not be able to do anything with @@ -153,12 +153,12 @@ function config_translation_config_translation_info(&$info) { } // Use the entity type as the plugin ID. - $info[$entity_type] = array( + $info[$entity_type_id] = array( 'class' => '\Drupal\config_translation\ConfigEntityMapper', - 'base_route_name' => $entity_info->getLinkTemplate('edit-form'), + 'base_route_name' => $entity_type->getLinkTemplate('edit-form'), 'title' => '!label !entity_type', 'names' => array(), - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'weight' => 10, ); } diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationBlockListController.php b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationBlockListController.php index 715195478dbb22197ca299398ef1c23e397def8c..c69dcde0c500f6caf457c0aa57a3e14c2cf9c528 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationBlockListController.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationBlockListController.php @@ -29,18 +29,18 @@ class ConfigTranslationBlockListController extends ConfigTranslationEntityListCo /** * {@inheritdoc} */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, ThemeHandlerInterface $theme_handler) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage, ThemeHandlerInterface $theme_handler) { + parent::__construct($entity_type, $storage); $this->themes = $theme_handler->listInfo(); } /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, - $container->get('entity.manager')->getStorageController($entity_info->id()), + $entity_type, + $container->get('entity.manager')->getStorageController($entity_type->id()), $container->get('theme_handler') ); } diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationFieldInstanceListController.php b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationFieldInstanceListController.php index b708ded078ea254cb31aa24efeed9418faf5dd74..760b8cb5ebf36b785ceeb181b4440425141bda15 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationFieldInstanceListController.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationFieldInstanceListController.php @@ -52,11 +52,11 @@ class ConfigTranslationFieldInstanceListController extends ConfigTranslationEnti /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { $entity_manager = $container->get('entity.manager'); return new static( - $entity_info, - $entity_manager->getStorageController($entity_info->id()), + $entity_type, + $entity_manager->getStorageController($entity_type->id()), $entity_manager ); } @@ -64,15 +64,15 @@ public static function createInstance(ContainerInterface $container, EntityTypeI /** * Constructs a new ConfigTranslationFieldInstanceListController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The entity storage controller class. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, EntityManagerInterface $entity_manager) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage, EntityManagerInterface $entity_manager) { + parent::__construct($entity_type, $storage); $this->entityManager = $entity_manager; } diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationOverviewTest.php b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationOverviewTest.php index bd999b48d9bc519604f79d80d372dadcde497a9e..59a29994a368682f27af2ced4f7e22c9df64a272 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationOverviewTest.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationOverviewTest.php @@ -93,16 +93,16 @@ public function testMapperListPage() { $this->assertLinkByHref($base_url . '/translate'); $this->assertText(String::checkPlain($test_entity->label())); - $entity_info = \Drupal::entityManager()->getDefinition($test_entity->getEntityTypeId()); + $entity_type = \Drupal::entityManager()->getDefinition($test_entity->getEntityTypeId()); $this->drupalGet($base_url . '/translate'); - $title = t('!label !entity_type', array('!label' => $test_entity->label(), '!entity_type' => $entity_info->getLowercaseLabel())); + $title = t('!label !entity_type', array('!label' => $test_entity->label(), '!entity_type' => $entity_type->getLowercaseLabel())); $title = t('Translations for %label', array('%label' => $title)); $this->assertRaw($title); $this->assertRaw('<th>' . t('Language') . '</th>'); $this->drupalGet($base_url); - $this->assertLink(t('Translate @title', array('@title' => $entity_info->getLowercaseLabel()))); + $this->assertLink(t('Translate @title', array('@title' => $entity_type->getLowercaseLabel()))); } } diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc index f509752e839463e7da6a74a06baa54498016e32d..a8a88ed2fc4c0c02bc61cfe50a693ea0f02dc8b1 100644 --- a/core/modules/content_translation/content_translation.admin.inc +++ b/core/modules/content_translation/content_translation.admin.inc @@ -65,8 +65,8 @@ function _content_translation_form_language_content_settings_form_alter(array &$ } $default = $form['entity_types']['#default_value']; - foreach ($default as $entity_type => $enabled) { - $default[$entity_type] = $enabled || content_translation_enabled($entity_type) ? $entity_type : FALSE; + foreach ($default as $entity_type_id => $enabled) { + $default[$entity_type_id] = $enabled || content_translation_enabled($entity_type_id) ? $entity_type_id : FALSE; } $form['entity_types']['#default_value'] = $default; @@ -75,25 +75,25 @@ function _content_translation_form_language_content_settings_form_alter(array &$ $dependent_options_settings = array(); $entity_manager = Drupal::entityManager(); - foreach ($form['#labels'] as $entity_type => $label) { - $entity_info = \Drupal::entityManager()->getDefinition($entity_type); - foreach (entity_get_bundles($entity_type) as $bundle => $bundle_info) { + foreach ($form['#labels'] as $entity_type_id => $label) { + $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); + foreach (entity_get_bundles($entity_type_id) as $bundle => $bundle_info) { // Here we do not want the widget to be altered and hold also the "Enable // translation" checkbox, which would be redundant. Hence we add this key // to be able to skip alterations. - $form['settings'][$entity_type][$bundle]['settings']['language']['#content_translation_skip_alter'] = TRUE; + $form['settings'][$entity_type_id][$bundle]['settings']['language']['#content_translation_skip_alter'] = TRUE; // Only show the checkbox to enable translation if the bundles in the // entity might have fields and if there are fields to translate. - if ($entity_info->isFieldable()) { - $fields = $entity_manager->getFieldDefinitions($entity_type, $bundle); + if ($entity_type->isFieldable()) { + $fields = $entity_manager->getFieldDefinitions($entity_type_id, $bundle); if ($fields) { - $form['settings'][$entity_type][$bundle]['translatable'] = array( + $form['settings'][$entity_type_id][$bundle]['translatable'] = array( '#type' => 'checkbox', - '#default_value' => content_translation_enabled($entity_type, $bundle), + '#default_value' => content_translation_enabled($entity_type_id, $bundle), ); - $field_settings = content_translation_get_config($entity_type, $bundle, 'fields'); + $field_settings = content_translation_get_config($entity_type_id, $bundle, 'fields'); foreach ($fields as $field_name => $definition) { $translatable = !empty($field_settings[$field_name]); @@ -101,20 +101,20 @@ function _content_translation_form_language_content_settings_form_alter(array &$ // translation. // @todo Remove this special casing as soon as configurable and // base field definitions are "unified". - if ($definition->isConfigurable() && ($field = FieldService::fieldInfo()->getField($entity_type, $field_name))) { - $instance = FieldService::fieldInfo()->getInstance($entity_type, $bundle, $field_name); - $form['settings'][$entity_type][$bundle]['fields'][$field_name] = array( + if ($definition->isConfigurable() && ($field = FieldService::fieldInfo()->getField($entity_type_id, $field_name))) { + $instance = FieldService::fieldInfo()->getInstance($entity_type_id, $bundle, $field_name); + $form['settings'][$entity_type_id][$bundle]['fields'][$field_name] = array( '#label' => $instance->getLabel(), '#type' => 'checkbox', '#default_value' => $translatable, ); $column_element = content_translation_field_sync_widget($instance); if ($column_element) { - $form['settings'][$entity_type][$bundle]['columns'][$field_name] = $column_element; + $form['settings'][$entity_type_id][$bundle]['columns'][$field_name] = $column_element; // @todo This should not concern only files. if (isset($column_element['#options']['file'])) { - $dependent_options_settings["settings[{$entity_type}][{$bundle}][columns][{$field_name}]"] = array('file'); + $dependent_options_settings["settings[{$entity_type_id}][{$bundle}][columns][{$field_name}]"] = array('file'); } } } @@ -123,7 +123,7 @@ function _content_translation_form_language_content_settings_form_alter(array &$ // determined through our settings. As a consequence only fields // that support translation can be enabled or disabled. elseif (isset($field_settings[$field_name]) || $definition->isTranslatable()) { - $form['settings'][$entity_type][$bundle]['fields'][$field_name] = array( + $form['settings'][$entity_type_id][$bundle]['fields'][$field_name] = array( '#label' => $definition->getLabel(), '#type' => 'checkbox', '#default_value' => $translatable, diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index 32cd77415cd39695d175bc78b25cd7b01b0e5c90..aea93499d85d50db58841751548512811fe1ae03 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -191,13 +191,13 @@ function content_translation_menu() { $items = array(); // Create tabs for all possible entity types. - foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $info) { + foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) { // Provide the translation UI only for enabled types. - if (content_translation_enabled($entity_type)) { - $path = _content_translation_link_to_router_path($entity_type, $info->getLinkTemplate('canonical')); + if (content_translation_enabled($entity_type_id)) { + $path = _content_translation_link_to_router_path($entity_type_id, $entity_type->getLinkTemplate('canonical')); $entity_position = count(explode('/', $path)) - 1; $keys = array_flip(array('load_arguments')); - $translation = $info->get('translation'); + $translation = $entity_type->get('translation'); $menu_info = array_intersect_key($translation['content_translation'], $keys) + array('file' => 'content_translation.pages.inc'); $item = array(); @@ -214,7 +214,7 @@ function content_translation_menu() { $args = array($entity_position, $language_position, $language_position + 1); $items["$path/translations/add/%language/%language"] = array( 'title' => 'Add', - 'route_name' => "content_translation.translation_add_$entity_type", + 'route_name' => "content_translation.translation_add_$entity_type_id", 'weight' => 1, ); @@ -222,14 +222,14 @@ function content_translation_menu() { $args = array($entity_position, $language_position); $items["$path/translations/edit/%language"] = array( 'title' => 'Edit', - 'route_name' => "content_translation.translation_edit_$entity_type", + 'route_name' => "content_translation.translation_edit_$entity_type_id", 'weight' => 1, ); // Delete translation callback. $items["$path/translations/delete/%language"] = array( 'title' => 'Delete', - 'route_name' => "content_translation.delete_$entity_type", + 'route_name' => "content_translation.delete_$entity_type_id", ) + $item; } } @@ -249,9 +249,9 @@ function content_translation_menu_alter(array &$items) { $items['admin/config/regional/content-language']['description'] = 'Configure language and translation support for content.'; // Check that the declared menu base paths are actually valid. - foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $info) { - if (content_translation_enabled($entity_type)) { - $path = _content_translation_link_to_router_path($entity_type, $info->getLinkTemplate('canonical')); + foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) { + if (content_translation_enabled($entity_type_id)) { + $path = _content_translation_link_to_router_path($entity_type_id, $entity_type->getLinkTemplate('canonical')); // If the base path is not defined we cannot provide the translation UI // for this entity type. In some cases the actual base path might not have @@ -264,7 +264,7 @@ function content_translation_menu_alter(array &$items) { $items["$path/translations/add/%language/%language"], $items["$path/translations/delete/%language"] ); - $t_args = array('@entity_type' => $info->getLabel() ?: $entity_type); + $t_args = array('@entity_type' => $entity_type->getLabel() ?: $entity_type_id); watchdog('content translation', 'The entities of type @entity_type do not define a valid base path: it will not be possible to translate them.', $t_args, WATCHDOG_WARNING); } else { @@ -353,11 +353,11 @@ function content_translation_translate_access(EntityInterface $entity) { * the current user. */ function content_translation_view_access(EntityInterface $entity, $langcode, AccountInterface $account = NULL) { - $entity_type = $entity->getEntityTypeId(); - $info = $entity->getEntityType(); - $permission = "translate $entity_type"; - if ($info->getPermissionGranularity() == 'bundle') { - $permission = "translate {$entity->bundle()} $entity_type"; + $entity_type_id = $entity->getEntityTypeId(); + $entity_type = $entity->getEntityType(); + $permission = "translate $entity_type_id"; + if ($entity_type->getPermissionGranularity() == 'bundle') { + $permission = "translate {$entity->bundle()} $entity_type_id"; } return !empty($entity->translation[$langcode]['status']) || user_access('translate any entity', $account) || user_access($permission, $account); } @@ -532,7 +532,7 @@ function content_translation_enabled($entity_type, $bundle = NULL) { /** * Content translation controller factory. * - * @param string $entity_type + * @param string $entity_type_id * The type of the entity being translated. * * @return \Drupal\content_translation\ContentTranslationControllerInterface @@ -540,11 +540,11 @@ function content_translation_enabled($entity_type, $bundle = NULL) { * * @todo Move to \Drupal\content_translation\ContentTranslationManager. */ -function content_translation_controller($entity_type) { - $entity_info = \Drupal::entityManager()->getDefinition($entity_type); +function content_translation_controller($entity_type_id) { + $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); // @todo Throw an exception if the key is missing. - $class = $entity_info->getControllerClass('translation'); - return new $class($entity_info); + $class = $entity_type->getControllerClass('translation'); + return new $class($entity_type); } /** @@ -609,16 +609,16 @@ function content_translation_permission() { // Create a translate permission for each enabled entity type and (optionally) // bundle. - foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $info) { - if ($permission_granularity = $info->getPermissionGranularity()) { - $t_args = array('@entity_label' => $info->getLowercaseLabel()); + foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) { + if ($permission_granularity = $entity_type->getPermissionGranularity()) { + $t_args = array('@entity_label' => $entity_type->getLowercaseLabel()); switch ($permission_granularity) { case 'bundle': - foreach (entity_get_bundles($entity_type) as $bundle => $bundle_info) { - if (content_translation_enabled($entity_type, $bundle)) { + foreach (entity_get_bundles($entity_type_id) as $bundle => $bundle_info) { + if (content_translation_enabled($entity_type_id, $bundle)) { $t_args['%bundle_label'] = isset($bundle_info['label']) ? $bundle_info['label'] : $bundle; - $permission["translate $bundle $entity_type"] = array( + $permission["translate $bundle $entity_type_id"] = array( 'title' => t('Translate %bundle_label @entity_label', $t_args), ); } @@ -626,8 +626,8 @@ function content_translation_permission() { break; case 'entity_type': - if (content_translation_enabled($entity_type)) { - $permission["translate $entity_type"] = array( + if (content_translation_enabled($entity_type_id)) { + $permission["translate $entity_type_id"] = array( 'title' => t('Translate @entity_label', $t_args), ); } diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php index 2a9f53bf9809b455b0fdce79ae0a9c3f74306c16..be3fe8553f85654d3ed892cfbf0faed7dad33261 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php @@ -40,7 +40,7 @@ public function __construct(EntityManagerInterface $manager) { * {@inheritdoc} */ public function access(Route $route, Request $request, AccountInterface $account) { - $entity_type = $request->attributes->get('_entity_type'); + $entity_type = $request->attributes->get('_entity_type_id'); /** @var $entity \Drupal\Core\Entity\EntityInterface */ if ($entity = $request->attributes->get($entity_type)) { $route_requirements = $route->getRequirements(); diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationOverviewAccess.php b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationOverviewAccess.php index 0676af580f19923aa2d1a367895cb066dc60f586..bc30db84dc03c2ab592cbae1e76e59e7a389116e 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationOverviewAccess.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationOverviewAccess.php @@ -39,7 +39,7 @@ public function __construct(EntityManagerInterface $manager) { * {@inheritdoc} */ public function access(Route $route, Request $request, AccountInterface $account) { - $entity_type = $request->attributes->get('_entity_type'); + $entity_type = $request->attributes->get('_entity_type_id'); if ($entity = $request->attributes->get($entity_type)) { // Get entity base info. $bundle = $entity->bundle(); diff --git a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php index ecb385e307405c56382666d8104adeadd77f0136..8337ee823f51a99000589672e218e4a71dd4e8d6 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php @@ -32,12 +32,12 @@ class ContentTranslationController implements ContentTranslationControllerInterf /** * Initializes an instance of the content translation controller. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The info array of the given entity type. */ - public function __construct($entity_info) { - $this->entityTypeId = $entity_info->id(); - $this->entityType = $entity_info; + public function __construct($entity_type) { + $this->entityTypeId = $entity_type->id(); + $this->entityType = $entity_type; } /** @@ -57,11 +57,11 @@ public function retranslate(EntityInterface $entity, $langcode = NULL) { public function getTranslationAccess(EntityInterface $entity, $op) { // @todo Move this logic into a translation access controller checking also // the translation language and the given account. - $info = $entity->getEntityType(); + $entity_type = $entity->getEntityType(); $translate_permission = TRUE; // If no permission granularity is defined this entity type does not need an // explicit translate permission. - if (!user_access('translate any entity') && $permission_granularity = $info->getPermissionGranularity()) { + if (!user_access('translate any entity') && $permission_granularity = $entity_type->getPermissionGranularity()) { $translate_permission = user_access($permission_granularity == 'bundle' ? "translate {$entity->bundle()} {$entity->getEntityTypeId()}" : "translate {$entity->getEntityTypeId()}"); } return $translate_permission && user_access("$op content translations"); diff --git a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManager.php b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManager.php index b5753104e03423fdc7c26466347f6aa92223a4d6..817d3f8aa0e39445f2efde55daae201d1ed51dcb 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManager.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManager.php @@ -34,9 +34,9 @@ public function __construct(EntityManagerInterface $manager) { /** * {@inheritdoc} */ - public function isSupported($entity_type) { - $info = $this->entityManager->getDefinition($entity_type); - return $info->isTranslatable() && $info->hasLinkTemplate('drupal:content-translation-overview'); + public function isSupported($entity_type_id) { + $entity_type = $this->entityManager->getDefinition($entity_type_id); + return $entity_type->isTranslatable() && $entity_type->hasLinkTemplate('drupal:content-translation-overview'); } /** @@ -44,9 +44,9 @@ public function isSupported($entity_type) { */ public function getSupportedEntityTypes() { $supported_types = array(); - foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) { - if ($this->isSupported($entity_type)) { - $supported_types[$entity_type] = $entity_info; + foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { + if ($this->isSupported($entity_type_id)) { + $supported_types[$entity_type_id] = $entity_type; } } return $supported_types; diff --git a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManagerInterface.php b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManagerInterface.php index d3aa162626732a0b200a69a6de799b8d0d8ee3e3..85911388cb28fec28ee3ca1b019da293fa7ea13f 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManagerInterface.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManagerInterface.php @@ -23,12 +23,12 @@ public function getSupportedEntityTypes(); /** * Checks whether an entity type supports translation. * - * @param string $entity_type + * @param string $entity_type_id * The entity type. * * @return bool * TRUE if an entity type is supported, FALSE otherwise. */ - public function isSupported($entity_type); + public function isSupported($entity_type_id); } diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Controller/ContentTranslationController.php b/core/modules/content_translation/lib/Drupal/content_translation/Controller/ContentTranslationController.php index 0550bde620fb359547df26ba1bb6ca8f568b9f39..31a33d2eb51d553c25c0b335da24803af5a8ec24 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Controller/ContentTranslationController.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Controller/ContentTranslationController.php @@ -18,7 +18,7 @@ class ContentTranslationController { * @todo Remove content_translation_overview(). */ public function overview(Request $request) { - $entity = $request->attributes->get($request->attributes->get('_entity_type')); + $entity = $request->attributes->get($request->attributes->get('_entity_type_id')); module_load_include('pages.inc', 'content_translation'); return content_translation_overview($entity); } @@ -27,7 +27,7 @@ public function overview(Request $request) { * @todo Remove content_translation_add_page(). */ public function add(Request $request, $source, $target) { - $entity = $request->attributes->get($request->attributes->get('_entity_type')); + $entity = $request->attributes->get($request->attributes->get('_entity_type_id')); module_load_include('pages.inc', 'content_translation'); $source = language_load($source); $target = language_load($target); @@ -38,7 +38,7 @@ public function add(Request $request, $source, $target) { * @todo Remove content_translation_edit_page(). */ public function edit(Request $request, $language) { - $entity = $request->attributes->get($request->attributes->get('_entity_type')); + $entity = $request->attributes->get($request->attributes->get('_entity_type_id')); module_load_include('pages.inc', 'content_translation'); $language = language_load($language); return content_translation_edit_page($entity, $language); diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Form/ContentTranslationDeleteForm.php b/core/modules/content_translation/lib/Drupal/content_translation/Form/ContentTranslationDeleteForm.php index 73ff61d3351537bedade339c5ee072580709c0ad..0b780e35029a5fd01880361e3407e84d04cafb1e 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Form/ContentTranslationDeleteForm.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Form/ContentTranslationDeleteForm.php @@ -38,8 +38,8 @@ public function getFormId() { /** * {@inheritdoc} */ - public function buildForm(array $form, array &$form_state, $_entity_type = NULL, $language = NULL) { - $this->entity = $this->getRequest()->attributes->get($_entity_type); + public function buildForm(array $form, array &$form_state, $_entity_type_id = NULL, $language = NULL) { + $this->entity = $this->getRequest()->attributes->get($_entity_type_id); $this->language = language_load($language); return parent::buildForm($form, $form_state); } diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationContextualLinks.php b/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationContextualLinks.php index 45575d0d9117ad1d557e5420bdcc360ec21c01aa..24ebbeef74794084692f267a097f3080f732dd45 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationContextualLinks.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationContextualLinks.php @@ -51,10 +51,10 @@ public static function create(ContainerInterface $container, $base_plugin_id) { */ public function getDerivativeDefinitions(array $base_plugin_definition) { // Create contextual links for translatable entity types. - foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type => $entity_info) { - $this->derivatives[$entity_type]['title'] = t('Translate'); - $this->derivatives[$entity_type]['route_name'] = $entity_info->getLinkTemplate('drupal:content-translation-overview'); - $this->derivatives[$entity_type]['group'] = $entity_type; + foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type_id => $entity_type) { + $this->derivatives[$entity_type_id]['title'] = t('Translate'); + $this->derivatives[$entity_type_id]['route_name'] = $entity_type->getLinkTemplate('drupal:content-translation-overview'); + $this->derivatives[$entity_type_id]['group'] = $entity_type_id; } return parent::getDerivativeDefinitions($base_plugin_definition); } diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php b/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php index fcb25f15eb65da6783867bdd049962210da61ba9..adb3aa48322f604289c89b66583841bc2ec7d6a8 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php @@ -59,15 +59,15 @@ public static function create(ContainerInterface $container, $base_plugin_id) { */ public function getDerivativeDefinitions(array $base_plugin_definition) { // Create tabs for all possible entity types. - foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type => $entity_info) { + foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type_id => $entity_type) { // Find the route name for the translation overview. - $translation_route_name = $entity_info->getLinkTemplate('drupal:content-translation-overview'); + $translation_route_name = $entity_type->getLinkTemplate('drupal:content-translation-overview'); $this->derivatives[$translation_route_name] = array( - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'title' => 'Translate', 'route_name' => $translation_route_name, - 'base_route' => $entity_info->getLinkTemplate('canonical'), + 'base_route' => $entity_type->getLinkTemplate('canonical'), ) + $base_plugin_definition; } return parent::getDerivativeDefinitions($base_plugin_definition); diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Routing/ContentTranslationRouteSubscriber.php b/core/modules/content_translation/lib/Drupal/content_translation/Routing/ContentTranslationRouteSubscriber.php index 105489b43d64b839936684e4582557d8947ab5ec..cab9ac415de5b6b18fbead5e76af70968cafa99e 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Routing/ContentTranslationRouteSubscriber.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Routing/ContentTranslationRouteSubscriber.php @@ -39,9 +39,9 @@ public function __construct(ContentTranslationManagerInterface $content_translat * {@inheritdoc} */ protected function alterRoutes(RouteCollection $collection, $provider) { - foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type => $entity_info) { + foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type_id => $entity_type) { // Try to get the route from the current collection. - if (!$entity_route = $collection->get($entity_info->getLinkTemplate('canonical'))) { + if (!$entity_route = $collection->get($entity_type->getLinkTemplate('canonical'))) { continue; } $path = $entity_route->getPath() . '/translations'; @@ -51,22 +51,22 @@ protected function alterRoutes(RouteCollection $collection, $provider) { array( '_content' => '\Drupal\content_translation\Controller\ContentTranslationController::overview', 'account' => 'NULL', - '_entity_type' => $entity_type, + '_entity_type_id' => $entity_type_id, ), array( - '_access_content_translation_overview' => $entity_type, + '_access_content_translation_overview' => $entity_type_id, '_permission' => 'translate any entity', ), array( '_access_mode' => 'ANY', 'parameters' => array( 'entity' => array( - 'type' => 'entity:' . $entity_type, + 'type' => 'entity:' . $entity_type_id, ), ), ) ); - $collection->add($entity_info->getLinkTemplate('drupal:content-translation-overview'), $route); + $collection->add($entity_type->getLinkTemplate('drupal:content-translation-overview'), $route); $route = new Route( $path . '/add/{source}/{target}', @@ -75,7 +75,7 @@ protected function alterRoutes(RouteCollection $collection, $provider) { 'source' => NULL, 'target' => NULL, '_title' => 'Add', - '_entity_type' => $entity_type, + '_entity_type_id' => $entity_type_id, ), array( @@ -86,12 +86,12 @@ protected function alterRoutes(RouteCollection $collection, $provider) { '_access_mode' => 'ANY', 'parameters' => array( 'entity' => array( - 'type' => 'entity:' . $entity_type, + 'type' => 'entity:' . $entity_type_id, ), ), ) ); - $collection->add("content_translation.translation_add_$entity_type", $route); + $collection->add("content_translation.translation_add_$entity_type_id", $route); $route = new Route( $path . '/edit/{language}', @@ -99,7 +99,7 @@ protected function alterRoutes(RouteCollection $collection, $provider) { '_content' => '\Drupal\content_translation\Controller\ContentTranslationController::edit', 'language' => NULL, '_title' => 'Edit', - '_entity_type' => $entity_type, + '_entity_type_id' => $entity_type_id, ), array( '_permission' => 'translate any entity', @@ -109,12 +109,12 @@ protected function alterRoutes(RouteCollection $collection, $provider) { '_access_mode' => 'ANY', 'parameters' => array( 'entity' => array( - 'type' => 'entity:' . $entity_type, + 'type' => 'entity:' . $entity_type_id, ), ), ) ); - $collection->add("content_translation.translation_edit_$entity_type", $route); + $collection->add("content_translation.translation_edit_$entity_type_id", $route); $route = new Route( $path . '/delete/{language}', @@ -122,7 +122,7 @@ protected function alterRoutes(RouteCollection $collection, $provider) { '_form' => '\Drupal\content_translation\Form\ContentTranslationDeleteForm', 'language' => NULL, '_title' => 'Delete', - '_entity_type' => $entity_type, + '_entity_type_id' => $entity_type_id, ), array( '_permission' => 'translate any entity', @@ -131,13 +131,13 @@ protected function alterRoutes(RouteCollection $collection, $provider) { array( 'parameters' => array( 'entity' => array( - 'type' => 'entity:' . $entity_type, + 'type' => 'entity:' . $entity_type_id, ), ), '_access_mode' => 'ANY', ) ); - $collection->add("content_translation.delete_$entity_type", $route); + $collection->add("content_translation.delete_$entity_type_id", $route); } } diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTestTranslationUITest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTestTranslationUITest.php index 5d99d07d13372b0603333e8acc2b86595eca5704..3b836b9a8a7cd3de6f84533dfcba997e6c25e686 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTestTranslationUITest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTestTranslationUITest.php @@ -32,7 +32,7 @@ public static function getInfo() { */ function setUp() { // Use the entity_test_mul as this has multilingual property support. - $this->entityType = 'entity_test_mul'; + $this->entityTypeId = 'entity_test_mul'; parent::setUp(); } diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php index f04f669cc83d736b85497177577cef2b5a045efb..259e4a28c9bbee8818cc12893ed92e88d4054529 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php @@ -58,16 +58,16 @@ protected function setupTestFields() { entity_create('field_entity', array( 'name' => $this->fieldName, - 'entity_type' => $this->entityType, + 'entity_type' => $this->entityTypeId, 'type' => 'image', 'cardinality' => $this->cardinality, 'translatable' => TRUE, ))->save(); entity_create('field_instance', array( - 'entity_type' => $this->entityType, + 'entity_type' => $this->entityTypeId, 'field_name' => $this->fieldName, - 'bundle' => $this->entityType, + 'bundle' => $this->entityTypeId, 'label' => 'Test translatable image field', 'settings' => array( 'translation_sync' => array( @@ -93,7 +93,7 @@ protected function getEditorPermissions() { function testImageFieldSync() { // Check that the alt and title fields are enabled for the image field. $this->drupalLogin($this->editor); - $this->drupalGet('entity_test_mul/structure/' . $this->entityType . '/fields/' . $this->entityType . '.' . $this->entityType . '.' . $this->fieldName); + $this->drupalGet('entity_test_mul/structure/' . $this->entityTypeId . '/fields/' . $this->entityTypeId . '.' . $this->entityTypeId . '.' . $this->fieldName); $this->assertFieldChecked('edit-instance-settings-translation-sync-alt'); $this->assertFieldChecked('edit-instance-settings-translation-sync-title'); $edit = array( @@ -132,7 +132,7 @@ function testImageFieldSync() { 'user_id' => mt_rand(1, 128), 'langcode' => $default_langcode, ); - $entity = entity_create($this->entityType, $values); + $entity = entity_create($this->entityTypeId, $values); // Create some file entities from the generated test files and store them. $values = array(); diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationTestBase.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationTestBase.php index 6e18d0f7c49e26db3c0c300a59ca6f915767a953..cb478d3eac8d54524f1cbc04420ee2cae1541384 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationTestBase.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationTestBase.php @@ -21,7 +21,7 @@ abstract class ContentTranslationTestBase extends WebTestBase { * * @var string */ - protected $entityType = 'entity_test_mul'; + protected $entityTypeId = 'entity_test_mul'; /** * The bundle being tested. @@ -81,7 +81,7 @@ function setUp() { $this->setupUsers(); $this->setupTestFields(); - $this->controller = content_translation_controller($this->entityType); + $this->controller = content_translation_controller($this->entityTypeId); // Rebuild the container so that the new languages are picked up by services // that hold a list of languages. @@ -110,9 +110,9 @@ protected function getTranslatorPermissions() { * Returns the translate permissions for the current entity and bundle. */ protected function getTranslatePermission() { - $info = \Drupal::entityManager()->getDefinition($this->entityType); - if ($permission_granularity = $info->getPermissionGranularity()) { - return $permission_granularity == 'bundle' ? "translate {$this->bundle} {$this->entityType}" : "translate {$this->entityType}"; + $entity_type = \Drupal::entityManager()->getDefinition($this->entityTypeId); + if ($permission_granularity = $entity_type->getPermissionGranularity()) { + return $permission_granularity == 'bundle' ? "translate {$this->bundle} {$this->entityTypeId}" : "translate {$this->entityTypeId}"; } } @@ -146,7 +146,7 @@ protected function setupUsers() { */ protected function setupBundle() { if (empty($this->bundle)) { - $this->bundle = $this->entityType; + $this->bundle = $this->entityTypeId; } } @@ -156,7 +156,7 @@ protected function setupBundle() { protected function enableTranslation() { // Enable translation for the current entity type and ensure the change is // picked up. - content_translation_set_config($this->entityType, $this->bundle, 'enabled', TRUE); + content_translation_set_config($this->entityTypeId, $this->bundle, 'enabled', TRUE); drupal_static_reset(); entity_info_cache_clear(); menu_router_rebuild(); @@ -171,17 +171,17 @@ protected function setupTestFields() { entity_create('field_entity', array( 'name' => $this->fieldName, 'type' => 'text', - 'entity_type' => $this->entityType, + 'entity_type' => $this->entityTypeId, 'cardinality' => 1, 'translatable' => TRUE, ))->save(); entity_create('field_instance', array( - 'entity_type' => $this->entityType, + 'entity_type' => $this->entityTypeId, 'field_name' => $this->fieldName, 'bundle' => $this->bundle, 'label' => 'Test translatable text-field', ))->save(); - entity_get_form_display($this->entityType, $this->bundle, 'default') + entity_get_form_display($this->entityTypeId, $this->bundle, 'default') ->setComponent($this->fieldName, array( 'type' => 'text_textfield', 'weight' => 0, @@ -206,11 +206,11 @@ protected function setupTestFields() { protected function createEntity($values, $langcode, $bundle_name = NULL) { $entity_values = $values; $entity_values['langcode'] = $langcode; - $info = \Drupal::entityManager()->getDefinition($this->entityType); - if ($bundle_key = $info->getKey('bundle')) { + $entity_type = \Drupal::entityManager()->getDefinition($this->entityTypeId); + if ($bundle_key = $entity_type->getKey('bundle')) { $entity_values[$bundle_key] = $bundle_name ?: $this->bundle; } - $controller = $this->container->get('entity.manager')->getStorageController($this->entityType); + $controller = $this->container->get('entity.manager')->getStorageController($this->entityTypeId); if (!($controller instanceof FieldableDatabaseStorageController)) { foreach ($values as $property => $value) { if (is_array($value)) { @@ -218,7 +218,7 @@ protected function createEntity($values, $langcode, $bundle_name = NULL) { } } } - $entity = entity_create($this->entityType, $entity_values); + $entity = entity_create($this->entityTypeId, $entity_values); $entity->save(); return $entity->id(); } diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php index 49c40e7d2ebe7aee8bd84f989b2ebabf73db647b..0816fce4af81e70b96a23b16fc6f1c208d0a919f 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php @@ -50,7 +50,7 @@ protected function doTestBasicTranslation() { $default_langcode = $this->langcodes[0]; $values[$default_langcode] = $this->getNewEntityValues($default_langcode); $this->entityId = $this->createEntity($values[$default_langcode], $default_langcode); - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); $this->assertTrue($entity, 'Entity found in the database.'); $this->drupalGet($entity->getSystemPath()); $this->assertResponse(200, 'Entity URL is valid.'); @@ -73,7 +73,7 @@ protected function doTestBasicTranslation() { if ($this->testLanguageSelector) { $this->assertNoFieldByXPath('//select[@id="edit-langcode"]', NULL, 'Language selector correclty disabled on translations.'); } - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); // Switch the source language. $langcode = 'fr'; @@ -87,7 +87,7 @@ protected function doTestBasicTranslation() { $values[$langcode] = $this->getNewEntityValues($langcode); $edit = $this->getEditValues($values, $langcode) + array('content_translation[retranslate]' => TRUE); $this->drupalPostForm($path, $edit, $this->getFormSubmitAction($entity)); - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); // Check that the entered values have been correctly stored. foreach ($values as $langcode => $property_values) { @@ -105,7 +105,7 @@ protected function doTestBasicTranslation() { * Tests that the translation overview shows the correct values. */ protected function doTestTranslationOverview() { - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); $this->drupalGet($entity->getSystemPath('drupal:content-translation-overview')); foreach ($this->langcodes as $langcode) { @@ -119,7 +119,7 @@ protected function doTestTranslationOverview() { * Tests up-to-date status tracking. */ protected function doTestOutdatedStatus() { - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); $langcode = 'fr'; $default_langcode = $this->langcodes[0]; @@ -127,7 +127,7 @@ protected function doTestOutdatedStatus() { $edit = array('content_translation[retranslate]' => TRUE); $edit_path = $entity->getSystemPath('edit-form'); $this->drupalPostForm($langcode . '/' . $edit_path, $edit, $this->getFormSubmitAction($entity)); - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); // Check that every translation has the correct "outdated" status. foreach ($this->langcodes as $enabled_langcode) { @@ -143,7 +143,7 @@ protected function doTestOutdatedStatus() { $this->drupalPostForm($path, $edit, $this->getFormSubmitAction($entity)); $this->drupalGet($path); $this->assertFieldByXPath('//input[@name="content_translation[retranslate]"]', FALSE, 'The retranslate flag is now shown.'); - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); $this->assertFalse($entity->translation[$enabled_langcode]['outdated'], 'The "outdated" status has been correctly stored.'); } } @@ -153,7 +153,7 @@ protected function doTestOutdatedStatus() { * Tests the translation publishing status. */ protected function doTestPublishedStatus() { - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); $path = $entity->getSystemPath('edit-form'); // Unpublish translations. @@ -161,7 +161,7 @@ protected function doTestPublishedStatus() { if ($index > 0) { $edit = array('content_translation[status]' => FALSE); $this->drupalPostForm($langcode . '/' . $path, $edit, $this->getFormSubmitAction($entity)); - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); $this->assertFalse($entity->translation[$langcode]['status'], 'The translation has been correctly unpublished.'); } } @@ -175,7 +175,7 @@ protected function doTestPublishedStatus() { * Tests the translation authoring information. */ protected function doTestAuthoringInfo() { - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); $path = $entity->getSystemPath('edit-form'); $values = array(); @@ -194,7 +194,7 @@ protected function doTestAuthoringInfo() { $this->drupalPostForm($prefix . $path, $edit, $this->getFormSubmitAction($entity)); } - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); foreach ($this->langcodes as $langcode) { $this->assertEqual($entity->translation[$langcode]['uid'], $values[$langcode]['uid'], 'Translation author correctly stored.'); $this->assertEqual($entity->translation[$langcode]['created'], $values[$langcode]['created'], 'Translation date correctly stored.'); @@ -219,11 +219,11 @@ protected function doTestAuthoringInfo() { protected function doTestTranslationDeletion() { // Confirm and delete a translation. $langcode = 'fr'; - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); $path = $entity->getSystemPath('edit-form'); $this->drupalPostForm($langcode . '/' . $path, array(), t('Delete translation')); $this->drupalPostForm(NULL, array(), t('Delete')); - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); if ($this->assertTrue(is_object($entity), 'Entity found')) { $translations = $entity->getTranslationLanguages(); $this->assertTrue(count($translations) == 2 && empty($translations[$langcode]), 'Translation successfully deleted.'); diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php index d5ac2034dcd62d1c4b2090350fbeb2fe6fc846ea..861aec91dafccd722634f3c6d9da4a1ff0ad6891 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php @@ -63,7 +63,7 @@ protected function setupEntity() { $this->fieldName => array(array('value' => $this->randomName(16))), ); $id = $this->createEntity($values, $default_langcode); - $this->entity = entity_load($this->entityType, $id, TRUE); + $this->entity = entity_load($this->entityTypeId, $id, TRUE); // Create a translation. $this->drupalLogin($this->translator); diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/Views/TranslationLinkTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/Views/TranslationLinkTest.php index fe453792412b55a176c4ddf9c1dfd1d2baac66bb..e1b939cc310e3296e9782371121a7412638aeecf 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/Views/TranslationLinkTest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/Views/TranslationLinkTest.php @@ -42,7 +42,7 @@ public static function getInfo() { function setUp() { // @todo Use entity_type once it is has multilingual Views integration. - $this->entityType = 'user'; + $this->entityTypeId = 'user'; parent::setUp(); diff --git a/core/modules/entity/entity.module b/core/modules/entity/entity.module index 60e8714e68b9011cc26f74275a720b717abe5458..4816d0b57dd3c99e2750569d4c3b7dc9b500441c 100644 --- a/core/modules/entity/entity.module +++ b/core/modules/entity/entity.module @@ -128,15 +128,15 @@ function entity_menu_link_defaults() { /** * Implements hook_entity_bundle_rename(). */ -function entity_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) { +function entity_entity_bundle_rename($entity_type_id, $bundle_old, $bundle_new) { // Rename entity displays. - $entity_info = \Drupal::entityManager()->getDefinition('entity_view_display'); + $entity_type = \Drupal::entityManager()->getDefinition('entity_view_display'); if ($bundle_old !== $bundle_new) { - $ids = config_get_storage_names_with_prefix('entity.view_display.' . $entity_type . '.' . $bundle_old . '.'); + $ids = config_get_storage_names_with_prefix('entity.view_display.' . $entity_type_id . '.' . $bundle_old . '.'); foreach ($ids as $id) { - $id = ConfigStorageController::getIDFromConfigName($id, $entity_info->getConfigPrefix()); + $id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix()); $display = entity_load('entity_view_display', $id); - $new_id = $entity_type . '.' . $bundle_new . '.' . $display->mode; + $new_id = $entity_type_id . '.' . $bundle_new . '.' . $display->mode; $display->id = $new_id; $display->bundle = $bundle_new; $display->save(); @@ -144,13 +144,13 @@ function entity_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) { } // Rename entity form displays. - $entity_info = \Drupal::entityManager()->getDefinition('entity_form_display'); + $entity_type = \Drupal::entityManager()->getDefinition('entity_form_display'); if ($bundle_old !== $bundle_new) { - $ids = config_get_storage_names_with_prefix('entity.form_display.' . $entity_type . '.' . $bundle_old . '.'); + $ids = config_get_storage_names_with_prefix('entity.form_display.' . $entity_type_id . '.' . $bundle_old . '.'); foreach ($ids as $id) { - $id = ConfigStorageController::getIDFromConfigName($id, $entity_info->getConfigPrefix()); + $id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix()); $form_display = entity_load('entity_form_display', $id); - $new_id = $entity_type . '.' . $bundle_new . '.' . $form_display->mode; + $new_id = $entity_type_id . '.' . $bundle_new . '.' . $form_display->mode; $form_display->id = $new_id; $form_display->bundle = $bundle_new; $form_display->save(); @@ -161,20 +161,20 @@ function entity_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) { /** * Implements hook_entity_bundle_delete(). */ -function entity_entity_bundle_delete($entity_type, $bundle) { +function entity_entity_bundle_delete($entity_type_id, $bundle) { // Remove entity displays of the deleted bundle. - $entity_info = \Drupal::entityManager()->getDefinition('entity_view_display'); - $ids = config_get_storage_names_with_prefix('entity.view_display.' . $entity_type . '.' . $bundle . '.'); + $entity_type = \Drupal::entityManager()->getDefinition('entity_view_display'); + $ids = config_get_storage_names_with_prefix('entity.view_display.' . $entity_type_id . '.' . $bundle . '.'); foreach ($ids as &$id) { - $id = ConfigStorageController::getIDFromConfigName($id, $entity_info->getConfigPrefix()); + $id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix()); } entity_delete_multiple('entity_view_display', $ids); // Remove entity form displays of the deleted bundle. - $entity_info = \Drupal::entityManager()->getDefinition('entity_form_display'); - $ids = config_get_storage_names_with_prefix('entity.form_display.' . $entity_type . '.' . $bundle . '.'); + $entity_type = \Drupal::entityManager()->getDefinition('entity_form_display'); + $ids = config_get_storage_names_with_prefix('entity.form_display.' . $entity_type_id . '.' . $bundle . '.'); foreach ($ids as &$id) { - $id = ConfigStorageController::getIDFromConfigName($id, $entity_info->getConfigPrefix()); + $id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix()); } entity_delete_multiple('entity_form_display', $ids); } @@ -185,10 +185,10 @@ function entity_entity_bundle_delete($entity_type, $bundle) { function entity_module_preuninstall($module) { // Clean up all entity bundles (including field instances) of every entity // type provided by the module that is being uninstalled. - foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $entity_info) { - if ($entity_info->getProvider() == $module) { - foreach (array_keys(entity_get_bundles($entity_type)) as $bundle) { - entity_invoke_bundle_hook('delete', $entity_type, $bundle); + foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) { + if ($entity_type->getProvider() == $module) { + foreach (array_keys(entity_get_bundles($entity_type_id)) as $bundle) { + entity_invoke_bundle_hook('delete', $entity_type_id, $bundle); } } } diff --git a/core/modules/entity/entity.routing.yml b/core/modules/entity/entity.routing.yml index 747dc064f9a861a8a25b79d9180ca5d8782fc10c..795cc62ca42f72e921d5aa011197aa84638d9b36 100644 --- a/core/modules/entity/entity.routing.yml +++ b/core/modules/entity/entity.routing.yml @@ -23,7 +23,7 @@ entity.view_mode_add: _permission: 'administer display modes' entity.view_mode_add_type: - path: '/admin/structure/display-modes/view/add/{entity_type}' + path: '/admin/structure/display-modes/view/add/{entity_type_id}' defaults: _entity_form: 'view_mode.add' _title: 'Add view mode' @@ -63,7 +63,7 @@ entity.form_mode_add: _permission: 'administer display modes' entity.form_mode_add_type: - path: '/admin/structure/display-modes/form/add/{entity_type}' + path: '/admin/structure/display-modes/form/add/{entity_type_id}' defaults: _entity_form: 'form_mode.add' _title: 'Add form mode' diff --git a/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php b/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php index caa61ea89c645d260e444feaa246be3a80e88e61..f0db9420f03b72b2d486d2fecf37cd79c9071bd2 100644 --- a/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php +++ b/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php @@ -22,11 +22,11 @@ class EntityDisplayModeController extends ControllerBase { */ public function viewModeTypeSelection() { $entity_types = array(); - foreach ($this->entityManager()->getDefinitions() as $entity_type => $entity_info) { - if ($entity_info->isFieldable() && $entity_info->hasViewBuilderClass()) { - $entity_types[$entity_type] = array( - 'title' => $entity_info->getLabel(), - 'link_path' => 'admin/structure/display-modes/view/add/' . $entity_type, + foreach ($this->entityManager()->getDefinitions() as $entity_type_id => $entity_type) { + if ($entity_type->isFieldable() && $entity_type->hasViewBuilderClass()) { + $entity_types[$entity_type_id] = array( + 'title' => $entity_type->getLabel(), + 'link_path' => 'admin/structure/display-modes/view/add/' . $entity_type_id, 'localized_options' => array(), ); } @@ -45,11 +45,11 @@ public function viewModeTypeSelection() { */ public function formModeTypeSelection() { $entity_types = array(); - foreach ($this->entityManager()->getDefinitions() as $entity_type => $entity_info) { - if ($entity_info->isFieldable() && $entity_info->hasFormClasses()) { - $entity_types[$entity_type] = array( - 'title' => $entity_info->getLabel(), - 'link_path' => 'admin/structure/display-modes/form/add/' . $entity_type, + foreach ($this->entityManager()->getDefinitions() as $entity_type_id => $entity_type) { + if ($entity_type->isFieldable() && $entity_type->hasFormClasses()) { + $entity_types[$entity_type_id] = array( + 'title' => $entity_type->getLabel(), + 'link_path' => 'admin/structure/display-modes/form/add/' . $entity_type_id, 'localized_options' => array(), ); } diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php index 6a90eab992c8d2acd38bf5d78a20482c16c8e67c..f1d84abcb5bcf918c1b7e11139002107ed3767c6 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php +++ b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php @@ -331,9 +331,9 @@ protected function getFieldDefinitions() { // $this->fieldDefinitions static cache ?) // https://drupal.org/node/2114707 $entity_manager = \Drupal::entityManager(); - $entity_info = $entity_manager->getDefinition($this->targetEntityType); + $entity_type = $entity_manager->getDefinition($this->targetEntityType); $definitions = array(); - if ($entity_info->isSubclassOf('\Drupal\Core\Entity\ContentEntityInterface')) { + if ($entity_type->isSubclassOf('\Drupal\Core\Entity\ContentEntityInterface')) { $entity = _field_create_entity_from_ids((object) array('entity_type' => $this->targetEntityType, 'bundle' => $this->bundle, 'entity_id' => NULL)); foreach ($entity as $field_name => $items) { $definitions[$field_name] = $items->getFieldDefinition(); diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayModeListController.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayModeListController.php index d904af2f4a7d1f67f7d81f0a4ca738caaa7c6290..3e244b3b58556fb0013cc226b1a22e705e9fa065 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityDisplayModeListController.php +++ b/core/modules/entity/lib/Drupal/entity/EntityDisplayModeListController.php @@ -28,27 +28,27 @@ class EntityDisplayModeListController extends ConfigEntityListController { /** * Constructs a new EntityListController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The entity storage controller class. - * @param \Drupal\Core\Entity\EntityTypeInterface[] $entity_info_complete - * The entity info for all entity types. + * @param \Drupal\Core\Entity\EntityTypeInterface[] $entity_types + * List of all entity types. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, array $entity_info_complete) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage, array $entity_types) { + parent::__construct($entity_type, $storage); - $this->entityTypes = $entity_info_complete; + $this->entityTypes = $entity_types; } /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { $entity_manager = $container->get('entity.manager'); return new static( - $entity_info, - $entity_manager->getStorageController($entity_info->id()), + $entity_type, + $entity_manager->getStorageController($entity_type->id()), $entity_manager->getDefinitions() ); } diff --git a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeAddForm.php b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeAddForm.php index dee20fbde5c12e7694d7263e15ae34d29aac61fe..b1aa3afaf78f9594a6ab52098a84953231fc6307 100644 --- a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeAddForm.php +++ b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeAddForm.php @@ -24,8 +24,8 @@ class EntityDisplayModeAddForm extends EntityDisplayModeFormBase { /** * {@inheritdoc} */ - public function buildForm(array $form, array &$form_state, $entity_type = NULL) { - $this->targetEntityTypeId = $entity_type; + public function buildForm(array $form, array &$form_state, $entity_type_id = NULL) { + $this->targetEntityTypeId = $entity_type_id; $form = parent::buildForm($form, $form_state); $definition = $this->entityManager->getDefinition($this->targetEntityTypeId); $form['#title'] = $this->t('Add new %label @entity-type', array('%label' => $definition->getLabel(), '@entity-type' => $this->entityType->getLowercaseLabel())); diff --git a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeDeleteForm.php b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeDeleteForm.php index 8de83778060a9ae00da2ffbc1adb0f318daa91fe..d2f22d081e730acf20aa0b3a0294ece0eb0d7a91 100644 --- a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeDeleteForm.php +++ b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeDeleteForm.php @@ -27,16 +27,16 @@ public function getCancelRoute() { * {@inheritdoc} */ public function getQuestion() { - $entity_info = $this->entity->getEntityType(); - return t('Are you sure you want to delete the %label @entity-type?', array('%label' => $this->entity->label(), '@entity-type' => $entity_info->getLowercaseLabel())); + $entity_type = $this->entity->getEntityType(); + return t('Are you sure you want to delete the %label @entity-type?', array('%label' => $this->entity->label(), '@entity-type' => $entity_type->getLowercaseLabel())); } /** * {@inheritdoc} */ public function getDescription() { - $entity_info = $this->entity->getEntityType(); - return t('Deleting a @entity-type will cause any output still requesting to use that @entity-type to use the default display settings.', array('@entity-type' => $entity_info->getLowercaseLabel())); + $entity_type = $this->entity->getEntityType(); + return t('Deleting a @entity-type will cause any output still requesting to use that @entity-type to use the default display settings.', array('@entity-type' => $entity_type->getLowercaseLabel())); } /** @@ -52,8 +52,8 @@ public function getConfirmText() { public function submit(array $form, array &$form_state) { parent::submit($form, $form_state); - $entity_info = $this->entity->getEntityType(); - drupal_set_message(t('Deleted the %label @entity-type.', array('%label' => $this->entity->label(), '@entity-type' => $entity_info->getLowercaseLabel()))); + $entity_type = $this->entity->getEntityType(); + drupal_set_message(t('Deleted the %label @entity-type.', array('%label' => $this->entity->label(), '@entity-type' => $entity_type->getLowercaseLabel()))); $this->entity->delete(); entity_info_cache_clear(); $form_state['redirect_route']['route_name'] = 'entity.' . $this->entity->getEntityTypeId() . '_list'; diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php index 1ea9233cacf62069cf706e77136c890a5eec2751..6131b30051e30653365e22e7e016e8486225a2e7 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php +++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php @@ -272,10 +272,10 @@ public function testRenameDeleteBundle() { entity_get_form_display('node', 'article', 'default')->save(); // Rename the article bundle and assert the entity display is renamed. - $info = node_type_load('article'); - $info->old_type = 'article'; - $info->type = 'article_rename'; - $info->save(); + $type = node_type_load('article'); + $type->old_type = 'article'; + $type->type = 'article_rename'; + $type->save(); $old_display = entity_load('entity_view_display', 'node.article.default'); $this->assertFalse($old_display); $old_form_display = entity_load('entity_form_display', 'node.article.default'); @@ -288,7 +288,7 @@ public function testRenameDeleteBundle() { $this->assertEqual('node.article_rename.default', $new_form_display->id); // Delete the bundle. - $info->delete(); + $type->delete(); $display = entity_load('entity_view_display', 'node.article_rename.default'); $this->assertFalse($display); $form_display = entity_load('entity_form_display', 'node.article_rename.default'); diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Derivative/SelectionBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Derivative/SelectionBase.php index 3e41599be94d80a856a2dce712df1c814f995158..80ecc168d51cfaa1f43c31935660c2c881cd04aa 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Derivative/SelectionBase.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Derivative/SelectionBase.php @@ -24,10 +24,10 @@ public function getDerivativeDefinitions(array $base_plugin_definition) { 'taxonomy_term', 'user' ); - foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $info) { - if (!in_array($entity_type, $supported_entities)) { - $this->derivatives[$entity_type] = $base_plugin_definition; - $this->derivatives[$entity_type]['label'] = t('@entity_type selection', array('@entity_type' => $info->getLabel())); + foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) { + if (!in_array($entity_type_id, $supported_entities)) { + $this->derivatives[$entity_type_id] = $base_plugin_definition; + $this->derivatives[$entity_type_id]['label'] = t('@entity_type selection', array('@entity_type' => $entity_type->getLabel())); } } return parent::getDerivativeDefinitions($base_plugin_definition); diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php index 2ec39ffd1271e0284febd2ccd6f80fbf58f40ffd..9e17b3856fded1bae899d308d2cac42fa276415a 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php @@ -183,9 +183,9 @@ protected function createNewEntity($label, $uid) { $bundle = reset($bundles); } - $entity_info = $entity_manager->getDefinition($target_type); - $bundle_key = $entity_info->getKey('bundle'); - $label_key = $entity_info->getKey('label'); + $entity_type = $entity_manager->getDefinition($target_type); + $bundle_key = $entity_type->getKey('bundle'); + $label_key = $entity_type->getKey('label'); $entity = $entity_manager->getStorageController($target_type)->create(array( $label_key => $label, diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php index 0986c1724f22897c3be6c45048ffbfde0242005a..f7b74e4dddcf4fc73c9b42aa4781b57576f49584 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php @@ -55,7 +55,7 @@ public function __construct(FieldDefinitionInterface $field_definition, EntityIn public static function settingsForm(FieldDefinitionInterface $field_definition) { $target_type = $field_definition->getSetting('target_type'); $selection_handler_settings = $field_definition->getSetting('handler_settings') ?: array(); - $entity_info = \Drupal::entityManager()->getDefinition($target_type); + $entity_type = \Drupal::entityManager()->getDefinition($target_type); $bundles = entity_get_bundles($target_type); // Merge-in default values. @@ -67,7 +67,7 @@ public static function settingsForm(FieldDefinitionInterface $field_definition) 'auto_create' => FALSE, ); - if ($entity_info->hasKey('bundle')) { + if ($entity_type->hasKey('bundle')) { $bundle_options = array(); foreach ($bundles as $bundle_name => $bundle_info) { $bundle_options[$bundle_name] = $bundle_info['label']; @@ -104,7 +104,7 @@ public static function settingsForm(FieldDefinitionInterface $field_definition) if ($target_type_info->isSubclassOf('\Drupal\Core\Entity\ContentEntityInterface')) { // @todo Use Entity::getPropertyDefinitions() when all entity types are // converted to the new Field API. - $fields = drupal_map_assoc(drupal_schema_fields_sql($entity_info->getBaseTable())); + $fields = drupal_map_assoc(drupal_schema_fields_sql($entity_type->getBaseTable())); foreach (field_info_instances($target_type) as $bundle_instances) { foreach ($bundle_instances as $instance_name => $instance) { foreach ($instance->getField()->getColumns() as $column_name => $column_info) { @@ -197,10 +197,10 @@ public function validateReferenceableEntities(array $ids) { $result = array(); if ($ids) { $target_type = $this->fieldDefinition->getSetting('target_type'); - $entity_info = \Drupal::entityManager()->getDefinition($target_type); + $entity_type = \Drupal::entityManager()->getDefinition($target_type); $query = $this->buildEntityQuery(); $result = $query - ->condition($entity_info->getKey('id'), $ids, 'IN') + ->condition($entity_type->getKey('id'), $ids, 'IN') ->execute(); } @@ -258,14 +258,14 @@ public function validateAutocompleteInput($input, &$element, &$form_state, $form public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') { $target_type = $this->fieldDefinition->getSetting('target_type'); $handler_settings = $this->fieldDefinition->getSetting('handler_settings'); - $entity_info = \Drupal::entityManager()->getDefinition($target_type); + $entity_type = \Drupal::entityManager()->getDefinition($target_type); $query = \Drupal::entityQuery($target_type); if (!empty($handler_settings['target_bundles'])) { - $query->condition($entity_info->getKey('bundle'), $handler_settings['target_bundles'], 'IN'); + $query->condition($entity_type->getKey('bundle'), $handler_settings['target_bundles'], 'IN'); } - if (isset($match) && $label_key = $entity_info->getKey('label')) { + if (isset($match) && $label_key = $entity_type->getKey('label')) { $query->condition($label_key, $match, $match_operator); } diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php index 4c7327d5624e3989ded1641cd93ea590588f243c..20707b84ce98489134d7b45de316a0647e305485 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php @@ -76,8 +76,8 @@ public function testFieldAdminHandler() { $this->assertFieldByName('field[settings][target_type]', 'node'); // Check that all entity types can be referenced. - foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $entity_info) { - $this->assertFieldByXPath("//select[@name='field[settings][target_type]']/option[@value='" . $entity_type . "']"); + foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) { + $this->assertFieldByXPath("//select[@name='field[settings][target_type]']/option[@value='" . $entity_type_id . "']"); } // Second step: 'Instance settings' form. @@ -87,8 +87,8 @@ public function testFieldAdminHandler() { $this->assertFieldByName('instance[settings][handler]', 'default'); // The base handler settings should be displayed. - $entity_type = 'node'; - $bundles = entity_get_bundles($entity_type); + $entity_type_id = 'node'; + $bundles = entity_get_bundles($entity_type_id); foreach ($bundles as $bundle_name => $bundle_info) { $this->assertFieldByName('instance[settings][handler_settings][target_bundles][' . $bundle_name . ']'); } diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 0aaffb5ae20b681634e842b47956d462eda08172..62ca21fc288a93ddea638c1c10d6db198ddeb2ce 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -676,14 +676,14 @@ function theme_field($variables) { */ function _field_create_entity_from_ids($ids) { $id_properties = array(); - $info = \Drupal::entityManager()->getDefinition($ids->entity_type); - if ($id_key = $info->getKey('id')) { + $entity_type = \Drupal::entityManager()->getDefinition($ids->entity_type); + if ($id_key = $entity_type->getKey('id')) { $id_properties[$id_key] = $ids->entity_id; } - if (isset($ids->revision_id) && $revision_key = $info->getKey('revision')) { + if (isset($ids->revision_id) && $revision_key = $entity_type->getKey('revision')) { $id_properties[$revision_key] = $ids->revision_id; } - if (isset($ids->bundle) && $bundle_key = $info->getKey('bundle')) { + if (isset($ids->bundle) && $bundle_key = $entity_type->getKey('bundle')) { $id_properties[$bundle_key] = $ids->bundle; } return entity_create($ids->entity_type, $id_properties); diff --git a/core/modules/field/field.views.inc b/core/modules/field/field.views.inc index 172aee4255ae58ef3566a26e06780c61f809a769..b9edf0dd64db3d661a4c3730c382127f75782692 100644 --- a/core/modules/field/field.views.inc +++ b/core/modules/field/field.views.inc @@ -125,36 +125,36 @@ function field_views_field_default_views_data(FieldInterface $field) { // Grab information about the entity type tables. $entity_manager = \Drupal::entityManager(); - $entity_type = $field->entity_type; - $entity_info = $entity_manager->getDefinition($entity_type); - if (!$entity_table = $entity_info->getBaseTable()) { + $entity_type_id = $field->entity_type; + $entity_type = $entity_manager->getDefinition($entity_type_id); + if (!$entity_table = $entity_type->getBaseTable()) { return $data; } - $entity_tables = array($entity_table => $entity_type); - $entity_revision_table = $entity_info->getRevisionTable(); - $supports_revisions = $entity_info->hasKey('revision') && $entity_revision_table; + $entity_tables = array($entity_table => $entity_type_id); + $entity_revision_table = $entity_type->getRevisionTable(); + $supports_revisions = $entity_type->hasKey('revision') && $entity_revision_table; if ($supports_revisions) { - $entity_tables[$entity_revision_table] = $entity_type; + $entity_tables[$entity_revision_table] = $entity_type_id; } // Description of the field tables. $field_tables = array( EntityStorageControllerInterface::FIELD_LOAD_CURRENT => array( 'table' => FieldableDatabaseStorageController::_fieldTableName($field), - 'alias' => "{$entity_type}__{$field_name}", + 'alias' => "{$entity_type_id}__{$field_name}", ), ); if ($supports_revisions) { $field_tables[EntityStorageControllerInterface::FIELD_LOAD_REVISION] = array( 'table' => FieldableDatabaseStorageController::_fieldRevisionTableName($field), - 'alias' => "{$entity_type}_revision__{$field_name}", + 'alias' => "{$entity_type_id}_revision__{$field_name}", ); } // Build the relationships between the field table and the entity tables. $table_alias = $field_tables[EntityStorageControllerInterface::FIELD_LOAD_CURRENT]['alias']; $data[$table_alias]['table']['join'][$entity_table] = array( - 'left_field' => $entity_info->getKey('id'), + 'left_field' => $entity_type->getKey('id'), 'field' => 'entity_id', 'extra' => array( array('field' => 'deleted', 'value' => 0, 'numeric' => TRUE), @@ -163,7 +163,7 @@ function field_views_field_default_views_data(FieldInterface $field) { if ($supports_revisions) { $table_alias = $field_tables[EntityStorageControllerInterface::FIELD_LOAD_REVISION]['alias']; $data[$table_alias]['table']['join'][$entity_revision_table] = array( - 'left_field' => $entity_info->getKey('revision'), + 'left_field' => $entity_type->getKey('revision'), 'field' => 'revision_id', 'extra' => array( array('field' => 'deleted', 'value' => 0, 'numeric' => TRUE), @@ -171,7 +171,7 @@ function field_views_field_default_views_data(FieldInterface $field) { ); } - $group_name = $entity_info->getLabel(); + $group_name = $entity_type->getLabel(); // Get the list of bundles the field appears in. $bundles_names = $field->getBundles(); // Build the list of additional fields to add to queries. @@ -182,7 +182,7 @@ function field_views_field_default_views_data(FieldInterface $field) { // Determine the label to use for the field. We don't have a label available // at the field level, so we just go through all instances and take the one // which is used the most frequently. - list($label, $all_labels) = field_views_field_label($entity_type, $field_name); + list($label, $all_labels) = field_views_field_label($entity_type_id, $field_name); // Expose data for the field as a whole. foreach ($field_tables as $type => $table_info) { @@ -242,7 +242,7 @@ function field_views_field_default_views_data(FieldInterface $field) { 'table' => $table, 'id' => 'field', 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, // Provide a real field for group by. 'real field' => $field_alias . '_' . $real_field, 'additional fields' => $add_fields, @@ -345,7 +345,7 @@ function field_views_field_default_views_data(FieldInterface $field) { 'id' => $argument, 'additional fields' => $additional_fields, 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'empty field name' => t('- No value -'), ); $data[$table_alias][$column_real_name]['filter'] = array( @@ -354,7 +354,7 @@ function field_views_field_default_views_data(FieldInterface $field) { 'id' => $filter, 'additional fields' => $additional_fields, 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'allow empty' => TRUE, ); if (!empty($allow_sort)) { @@ -364,7 +364,7 @@ function field_views_field_default_views_data(FieldInterface $field) { 'id' => $sort, 'additional fields' => $additional_fields, 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, ); } @@ -389,7 +389,7 @@ function field_views_field_default_views_data(FieldInterface $field) { 'additional fields' => $additional_fields, 'empty field name' => t('- No value -'), 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, ); $data[$table_alias]['delta']['filter'] = array( 'field' => 'delta', @@ -397,7 +397,7 @@ function field_views_field_default_views_data(FieldInterface $field) { 'id' => 'numeric', 'additional fields' => $additional_fields, 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'allow empty' => TRUE, ); $data[$table_alias]['delta']['sort'] = array( @@ -406,7 +406,7 @@ function field_views_field_default_views_data(FieldInterface $field) { 'id' => 'standard', 'additional fields' => $additional_fields, 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, ); } @@ -431,7 +431,7 @@ function field_views_field_default_views_data(FieldInterface $field) { 'additional fields' => $additional_fields, 'empty field name' => t('- No value -'), 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, ); $data[$table_alias]['language']['filter'] = array( 'field' => 'language', @@ -439,7 +439,7 @@ function field_views_field_default_views_data(FieldInterface $field) { 'id' => 'language', 'additional fields' => $additional_fields, 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'allow empty' => TRUE, ); $data[$table_alias]['language']['sort'] = array( @@ -448,7 +448,7 @@ function field_views_field_default_views_data(FieldInterface $field) { 'id' => 'standard', 'additional fields' => $additional_fields, 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, ); } } diff --git a/core/modules/field/lib/Drupal/field/Entity/Field.php b/core/modules/field/lib/Drupal/field/Entity/Field.php index 3e5a63f30689d9e9f86f2fbbb858ddeda7777add..1085f7901e926976cf061a9385b32b6283ef3173 100644 --- a/core/modules/field/lib/Drupal/field/Entity/Field.php +++ b/core/modules/field/lib/Drupal/field/Entity/Field.php @@ -319,9 +319,9 @@ protected function preSaveNew(EntityStorageControllerInterface $storage_controll // Disallow reserved field names. This can't prevent all field name // collisions with existing entity properties, but some is better than // none. - foreach ($entity_manager->getDefinitions() as $type => $info) { - if (in_array($this->name, $info->getKeys())) { - throw new FieldException(format_string('Attempt to create field %name which is reserved by entity type %type.', array('%name' => $this->name, '%type' => $type))); + foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) { + if (in_array($this->name, $entity_type->getKeys())) { + throw new FieldException(format_string('Attempt to create field %name which is reserved by entity type %type.', array('%name' => $this->name, '%type' => $entity_type_id))); } } @@ -669,8 +669,8 @@ public function hasData() { $columns = array_keys($storage_details['columns']); $factory = \Drupal::service('entity.query'); // Entity Query throws an exception if there is no base table. - $entity_info = \Drupal::entityManager()->getDefinition($this->entity_type); - if (!$entity_info->getBaseTable()) { + $entity_type = \Drupal::entityManager()->getDefinition($this->entity_type); + if (!$entity_type->getBaseTable()) { return FALSE; } $query = $factory->get($this->entity_type); diff --git a/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php b/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php index 086f206e7eea7eb12bdd3b689e6f9ead1134587e..26c43b6f05a591685ac9b2c991023f456f3fd878 100644 --- a/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php +++ b/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php @@ -520,8 +520,8 @@ protected function linkTemplates() { */ protected function urlRouteParameters($rel) { $parameters = parent::urlRouteParameters($rel); - $entity_info = \Drupal::entityManager()->getDefinition($this->entity_type); - $parameters[$entity_info->getBundleEntityType()] = $this->bundle; + $entity_type = \Drupal::entityManager()->getDefinition($this->entity_type); + $parameters[$entity_type->getBundleEntityType()] = $this->bundle; return $parameters; } diff --git a/core/modules/field/lib/Drupal/field/FieldInstanceStorageController.php b/core/modules/field/lib/Drupal/field/FieldInstanceStorageController.php index 793f231c6b7cb1c0bccf39a8f2012cc29af9d7a9..82c03e9eda5b6015363b739bb6c3724bdefef640 100644 --- a/core/modules/field/lib/Drupal/field/FieldInstanceStorageController.php +++ b/core/modules/field/lib/Drupal/field/FieldInstanceStorageController.php @@ -46,8 +46,8 @@ class FieldInstanceStorageController extends ConfigStorageController { /** * Constructs a FieldInstanceStorageController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Config\ConfigFactory $config_factory * The config factory service. * @param \Drupal\Core\Config\StorageInterface $config_storage @@ -61,8 +61,8 @@ class FieldInstanceStorageController extends ConfigStorageController { * @param \Drupal\Core\KeyValueStore\StateInterface $state * The state key value store. */ - public function __construct(EntityTypeInterface $entity_info, ConfigFactory $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, UuidInterface $uuid_service, EntityManagerInterface $entity_manager, StateInterface $state) { - parent::__construct($entity_info, $config_factory, $config_storage, $entity_query_factory, $uuid_service); + public function __construct(EntityTypeInterface $entity_type, ConfigFactory $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, UuidInterface $uuid_service, EntityManagerInterface $entity_manager, StateInterface $state) { + parent::__construct($entity_type, $config_factory, $config_storage, $entity_query_factory, $uuid_service); $this->entityManager = $entity_manager; $this->state = $state; } @@ -70,9 +70,9 @@ public function __construct(EntityTypeInterface $entity_info, ConfigFactory $con /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('config.factory'), $container->get('config.storage'), $container->get('entity.query'), diff --git a/core/modules/field/lib/Drupal/field/FieldStorageController.php b/core/modules/field/lib/Drupal/field/FieldStorageController.php index 71327e70c8af6f159509954283f2d7f993b01d6a..4a9727b3b68a8d4ff4e33a8dd9f49926a5f04ec8 100644 --- a/core/modules/field/lib/Drupal/field/FieldStorageController.php +++ b/core/modules/field/lib/Drupal/field/FieldStorageController.php @@ -48,8 +48,8 @@ class FieldStorageController extends ConfigStorageController { /** * Constructs a FieldStorageController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Config\ConfigFactory $config_factory * The config factory service. * @param \Drupal\Core\Config\StorageInterface $config_storage @@ -65,8 +65,8 @@ class FieldStorageController extends ConfigStorageController { * @param \Drupal\Core\KeyValueStore\StateInterface $state * The state key value store. */ - public function __construct(EntityTypeInterface $entity_info, ConfigFactory $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, UuidInterface $uuid_service, EntityManagerInterface $entity_manager, ModuleHandler $module_handler, StateInterface $state) { - parent::__construct($entity_info, $config_factory, $config_storage, $entity_query_factory, $uuid_service); + public function __construct(EntityTypeInterface $entity_type, ConfigFactory $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, UuidInterface $uuid_service, EntityManagerInterface $entity_manager, ModuleHandler $module_handler, StateInterface $state) { + parent::__construct($entity_type, $config_factory, $config_storage, $entity_query_factory, $uuid_service); $this->entityManager = $entity_manager; $this->moduleHandler = $module_handler; $this->state = $state; @@ -75,9 +75,9 @@ public function __construct(EntityTypeInterface $entity_info, ConfigFactory $con /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('config.factory'), $container->get('config.storage'), $container->get('entity.query'), diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php index 267c3617c402a7ff45f667a7a3088ae42140d654..8b67798a0310b0edf5453c78ffe7a7fda7ddd9a5 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php @@ -24,12 +24,12 @@ function testFieldInfo() { // Test that field_test module's fields, widgets, and formatters show up. $field_test_info = $this->getExpectedFieldTypeDefinition(); - $info = \Drupal::service('plugin.manager.field.field_type')->getConfigurableDefinitions(); + $entity_type = \Drupal::service('plugin.manager.field.field_type')->getConfigurableDefinitions(); foreach ($field_test_info as $t_key => $field_type) { foreach ($field_type as $key => $val) { - $this->assertEqual($info[$t_key][$key], $val, format_string('Field type %t_key key %key is %value', array('%t_key' => $t_key, '%key' => $key, '%value' => print_r($val, TRUE)))); + $this->assertEqual($entity_type[$t_key][$key], $val, format_string('Field type %t_key key %key is %value', array('%t_key' => $t_key, '%key' => $key, '%value' => print_r($val, TRUE)))); } - $this->assertEqual($info[$t_key]['provider'], 'field_test', 'Field type field_test module appears.'); + $this->assertEqual($entity_type[$t_key]['provider'], 'field_test', 'Field type field_test module appears.'); } // Verify that no unexpected instances exist. @@ -70,10 +70,10 @@ function testFieldInfo() { $instance = entity_create('field_instance', $instance_definition); $instance->save(); - $info = \Drupal::entityManager()->getDefinition('entity_test'); + $entity_type = \Drupal::entityManager()->getDefinition('entity_test'); $instances = field_info_instances('entity_test', $instance->bundle); $this->assertEqual(count($instances), 1, format_string('One instance shows up in info when attached to a bundle on a @label.', array( - '@label' => $info->getLabel(), + '@label' => $entity_type->getLabel(), ))); $this->assertTrue($instance_definition < $instances[$instance->getName()], 'Instance appears in info correctly'); diff --git a/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php b/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php index b2a0b15d7ce83474261034d6e664dfabf7d748d9..8f5a4b12887f84024f0922624d311c54df50e0cd 100644 --- a/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php @@ -19,7 +19,7 @@ class TranslationTest extends FieldUnitTestBase { /** * Modules to enable. * - * node is required because the tests alter node entity info. + * node is required because the tests alter the node entity type. * * @var array */ @@ -118,13 +118,13 @@ function setUp() { function testTranslatableFieldSaveLoad() { // Enable field translations for nodes. field_test_entity_info_translatable('node', TRUE); - $entity_info = \Drupal::entityManager()->getDefinition('node'); - $this->assertTrue($entity_info->isTranslatable(), 'Nodes are translatable.'); + $entity_type = \Drupal::entityManager()->getDefinition('node'); + $this->assertTrue($entity_type->isTranslatable(), 'Nodes are translatable.'); // Prepare the field translations. - $entity_type = 'entity_test'; - field_test_entity_info_translatable($entity_type, TRUE); - $entity = entity_create($entity_type, array('type' => $this->instance->bundle)); + $entity_type_id = 'entity_test'; + field_test_entity_info_translatable($entity_type_id, TRUE); + $entity = entity_create($entity_type_id, array('type' => $this->instance->bundle)); $field_translations = array(); $available_langcodes = array_keys(language_list()); $entity->langcode->value = reset($available_langcodes); @@ -164,7 +164,7 @@ function testTranslatableFieldSaveLoad() { $translation_langcodes = array_values($translation_langcodes); $values = array('type' => $instance->bundle, 'langcode' => $translation_langcodes[0]); - $entity = entity_create($entity_type, $values); + $entity = entity_create($entity_type_id, $values); foreach ($translation_langcodes as $langcode) { $values[$this->field_name][$langcode] = $this->_generateTestFieldValues($this->field->getCardinality()); $entity->getTranslation($langcode, FALSE)->{$this->field_name}->setValue($values[$this->field_name][$langcode]); @@ -182,7 +182,7 @@ function testTranslatableFieldSaveLoad() { // Check that explicit empty values are not overridden with default values. foreach (array(NULL, array()) as $empty_items) { $values = array('type' => $instance->bundle, 'langcode' => $translation_langcodes[0]); - $entity = entity_create($entity_type, $values); + $entity = entity_create($entity_type_id, $values); foreach ($translation_langcodes as $langcode) { $values[$this->field_name][$langcode] = $this->_generateTestFieldValues($this->field->getCardinality()); $entity->getTranslation($langcode)->{$this->field_name}->setValue($values[$this->field_name][$langcode]); diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index bb8ec0b46f5bb8257fb7a1384152319c519b23c5..77b7181aa059911bb7a7795f58b6e9b2928868c0 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -86,19 +86,19 @@ function field_ui_menu_link_defaults() { function field_ui_permission() { $permissions = array(); - foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $entity_info) { - if ($entity_info->isFieldable()) { + foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) { + if ($entity_type->isFieldable()) { // Create a permission for each fieldable entity to manage // the fields and the display. - $permissions['administer ' . $entity_type . ' fields'] = array( - 'title' => t('%entity_label: Administer fields', array('%entity_label' => $entity_info->getLabel())), + $permissions['administer ' . $entity_type_id . ' fields'] = array( + 'title' => t('%entity_label: Administer fields', array('%entity_label' => $entity_type->getLabel())), 'restrict access' => TRUE, ); - $permissions['administer ' . $entity_type . ' form display'] = array( - 'title' => t('%entity_label: Administer form display', array('%entity_label' => $entity_info->getLabel())) + $permissions['administer ' . $entity_type_id . ' form display'] = array( + 'title' => t('%entity_label: Administer form display', array('%entity_label' => $entity_type->getLabel())) ); - $permissions['administer ' . $entity_type . ' display'] = array( - 'title' => t('%entity_label: Administer display', array('%entity_label' => $entity_info->getLabel())) + $permissions['administer ' . $entity_type_id . ' display'] = array( + 'title' => t('%entity_label: Administer display', array('%entity_label' => $entity_type->getLabel())) ); } } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Access/FormModeAccessCheck.php b/core/modules/field_ui/lib/Drupal/field_ui/Access/FormModeAccessCheck.php index ece0c63f4bd2f796e17a2184c121b2cb2d673512..48de41ec411194c99f264593e61b252d0734042f 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Access/FormModeAccessCheck.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Access/FormModeAccessCheck.php @@ -39,19 +39,19 @@ public function __construct(EntityManagerInterface $entity_manager) { * {@inheritdoc} */ public function access(Route $route, Request $request, AccountInterface $account) { - if ($entity_type = $route->getDefault('entity_type')) { + if ($entity_type_id = $route->getDefault('entity_type_id')) { $form_mode = $request->attributes->get('form_mode_name'); if (!($bundle = $request->attributes->get('bundle'))) { - $entity_info = $this->entityManager->getDefinition($entity_type); - $bundle = $request->attributes->get('_raw_variables')->get($entity_info->getBundleEntityType()); + $entity_type = $this->entityManager->getDefinition($entity_type_id); + $bundle = $request->attributes->get('_raw_variables')->get($entity_type->getBundleEntityType()); } $visibility = FALSE; if (!$form_mode || $form_mode == 'default') { $visibility = TRUE; } - elseif ($entity_display = $this->entityManager->getStorageController('entity_form_display')->load($entity_type . '.' . $bundle . '.' . $form_mode)) { + elseif ($entity_display = $this->entityManager->getStorageController('entity_form_display')->load($entity_type_id . '.' . $bundle . '.' . $form_mode)) { $visibility = $entity_display->status(); } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php b/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php index 59797edba27ba7a320414293120d9a73853f773d..8b115df4512a3567fa3dd650b560678bcc0ffe7b 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php @@ -39,19 +39,19 @@ public function __construct(EntityManagerInterface $entity_manager) { * {@inheritdoc} */ public function access(Route $route, Request $request, AccountInterface $account) { - if ($entity_type = $route->getDefault('entity_type')) { + if ($entity_type_id = $route->getDefault('entity_type_id')) { $view_mode = $request->attributes->get('view_mode_name'); if (!($bundle = $request->attributes->get('bundle'))) { - $entity_info = $this->entityManager->getDefinition($entity_type); - $bundle = $request->attributes->get('_raw_variables')->get($entity_info->getBundleEntityType()); + $entity_type = $this->entityManager->getDefinition($entity_type_id); + $bundle = $request->attributes->get('_raw_variables')->get($entity_type->getBundleEntityType()); } $visibility = FALSE; if (!$view_mode || $view_mode == 'default') { $visibility = TRUE; } - elseif ($entity_display = $this->entityManager->getStorageController('entity_view_display')->load($entity_type . '.' . $bundle . '.' . $view_mode)) { + elseif ($entity_display = $this->entityManager->getStorageController('entity_view_display')->load($entity_type_id . '.' . $bundle . '.' . $view_mode)) { $visibility = $entity_display->status(); } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php index a7e3c5ce9f9a66e075016d57befd2ded93928055..de4ddd9417f899e48cce5f6d34aeed56001a34d2 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php @@ -42,12 +42,12 @@ public function getFormId() { /** * {@inheritdoc} */ - public function buildForm(array $form, array &$form_state, $entity_type = NULL, $bundle = NULL) { + public function buildForm(array $form, array &$form_state, $entity_type_id = NULL, $bundle = NULL) { if ($this->getRequest()->attributes->has('view_mode_name')) { $this->mode = $this->getRequest()->attributes->get('view_mode_name'); } - return parent::buildForm($form, $form_state, $entity_type, $bundle); + return parent::buildForm($form, $form_state, $entity_type_id, $bundle); } /** diff --git a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php index bb809a05a892afe05c700cd013c4fe425b5a5dd5..2ed54e87000bc47af392465661756e4872f271e2 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php @@ -110,8 +110,8 @@ protected function getFieldDefinitions() { /** * {@inheritdoc} */ - public function buildForm(array $form, array &$form_state, $entity_type = NULL, $bundle = NULL) { - parent::buildForm($form, $form_state, $entity_type, $bundle); + public function buildForm(array $form, array &$form_state, $entity_type_id = NULL, $bundle = NULL) { + parent::buildForm($form, $form_state, $entity_type_id, $bundle); if (empty($this->mode)) { $this->mode = 'default'; @@ -769,8 +769,8 @@ protected function getExtraFieldVisibilityOptions() { protected function getDisplays() { $load_ids = array(); $display_entity_type = $this->getDisplayType(); - $entity_info = $this->entityManager->getDefinition($display_entity_type); - $config_prefix = $entity_info->getConfigPrefix(); + $entity_type = $this->entityManager->getDefinition($display_entity_type); + $config_prefix = $entity_type->getConfigPrefix(); $ids = config_get_storage_names_with_prefix($config_prefix . '.' . $this->entity_type . '.' . $this->bundle . '.'); foreach ($ids as $id) { $config_id = str_replace($config_prefix . '.', '', $id); diff --git a/core/modules/field_ui/lib/Drupal/field_ui/FieldListController.php b/core/modules/field_ui/lib/Drupal/field_ui/FieldListController.php index 7a6bf7504644eab35a274f298e8e7f7acf0f073c..9ccfe220c9594436c8340ddbfdcbf7d1665e55a9 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/FieldListController.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/FieldListController.php @@ -50,15 +50,15 @@ class FieldListController extends ConfigEntityListController { /** * Constructs a new EntityListController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager * The 'field type' plugin manager. */ - public function __construct(EntityTypeInterface $entity_info, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager) { - parent::__construct($entity_info, $entity_manager->getStorageController($entity_info->id())); + public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager) { + parent::__construct($entity_type, $entity_manager->getStorageController($entity_type->id())); $this->entityManager = $entity_manager; $this->bundles = entity_get_bundles(); @@ -69,9 +69,9 @@ public function __construct(EntityTypeInterface $entity_info, EntityManagerInter /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('entity.manager'), $container->get('plugin.manager.field.field_type') ); diff --git a/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php index 5fd2f693925859fbfbd146fb80f6b804e3300f1e..e281f0e3c68adbf759e8a8654926c91da8b23419 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php @@ -84,8 +84,8 @@ public function getFormId() { /** * {@inheritdoc} */ - public function buildForm(array $form, array &$form_state, $entity_type = NULL, $bundle = NULL) { - parent::buildForm($form, $form_state, $entity_type, $bundle); + public function buildForm(array $form, array &$form_state, $entity_type_id = NULL, $bundle = NULL) { + parent::buildForm($form, $form_state, $entity_type_id, $bundle); // Gather bundle information. $instances = field_info_instances($this->entity_type, $this->bundle); diff --git a/core/modules/field_ui/lib/Drupal/field_ui/FieldUI.php b/core/modules/field_ui/lib/Drupal/field_ui/FieldUI.php index c0ed6696cb7a714fecd31b217dfdacc28d6eba79..4ccb079614af1f7e2a5dc9e3253516137da769af 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/FieldUI.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/FieldUI.php @@ -17,7 +17,7 @@ class FieldUI { /** * Returns the route info for the field overview of a given entity bundle. * - * @param string $entity_type + * @param string $entity_type_id * An entity type. * @param string $bundle * The entity bundle. @@ -31,13 +31,13 @@ class FieldUI { * \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for * comprehensive documentation. */ - public static function getOverviewRouteInfo($entity_type, $bundle) { - $entity_info = \Drupal::entityManager()->getDefinition($entity_type); - if ($entity_info->hasLinkTemplate('admin-form')) { + public static function getOverviewRouteInfo($entity_type_id, $bundle) { + $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); + if ($entity_type->hasLinkTemplate('admin-form')) { return array( - 'route_name' => "field_ui.overview_$entity_type", + 'route_name' => "field_ui.overview_$entity_type_id", 'route_parameters' => array( - $entity_info->getBundleEntityType() => $bundle, + $entity_type->getBundleEntityType() => $bundle, ), 'options' => array(), ); 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 751f1f5da0e0aca7fc2c9099041ef2df4bff3553..870436f491391cff29dcf3ad3cf808d75ed33e29 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 @@ -215,11 +215,11 @@ public function delete(array &$form, array &$form_state) { $destination = drupal_get_destination(); $request->query->remove('destination'); } - $entity_info = $this->entityManager->getDefinition($this->instance->entity_type); + $entity_type = $this->entityManager->getDefinition($this->instance->entity_type); $form_state['redirect_route'] = array( 'route_name' => 'field_ui.delete_' . $this->instance->entity_type, 'route_parameters' => array( - $entity_info->getBundleEntityType() => $this->instance->bundle, + $entity_type->getBundleEntityType() => $this->instance->bundle, 'field_instance' => $this->instance->id(), ), 'options' => array( diff --git a/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php index 0f0590718f472b28ab22528ca4f62369567a19f1..0b5298170dbe453dadc244dc0fa608f83d9a35eb 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php @@ -42,12 +42,12 @@ public function getFormId() { /** * {@inheritdoc} */ - public function buildForm(array $form, array &$form_state, $entity_type = NULL, $bundle = NULL) { + public function buildForm(array $form, array &$form_state, $entity_type_id = NULL, $bundle = NULL) { if ($this->getRequest()->attributes->has('form_mode_name')) { $this->mode = $this->getRequest()->attributes->get('form_mode_name'); } - return parent::buildForm($form, $form_state, $entity_type, $bundle); + return parent::buildForm($form, $form_state, $entity_type_id, $bundle); } /** diff --git a/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php b/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php index 334914b63dcc6c291c910999433bf67b64ecf57b..5e28958385b217d34638c133006d5ab52548555d 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php @@ -73,9 +73,9 @@ public static function create(ContainerInterface $container) { /** * {@inheritdoc} */ - public function buildForm(array $form, array &$form_state, $entity_type = NULL, $bundle = NULL) { - $entity_info = $this->entityManager->getDefinition($entity_type); - $this->bundleEntityType = $entity_info->getBundleEntityType(); + public function buildForm(array $form, array &$form_state, $entity_type_id = NULL, $bundle = NULL) { + $entity_type = $this->entityManager->getDefinition($entity_type_id); + $this->bundleEntityType = $entity_type->getBundleEntityType(); if (!isset($form_state['bundle'])) { if (!$bundle) { $bundle = $this->getRequest()->attributes->get('_raw_variables')->get($this->bundleEntityType); @@ -83,7 +83,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL, $form_state['bundle'] = $bundle; } - $this->entity_type = $entity_type; + $this->entity_type = $entity_type_id; $this->bundle = $form_state['bundle']; // When displaying the form, make sure the list of fields is up-to-date. diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Plugin/Derivative/FieldUiLocalTask.php b/core/modules/field_ui/lib/Drupal/field_ui/Plugin/Derivative/FieldUiLocalTask.php index 602acc25ac4646e51d7e7a643a70c2a44fcc7aac..e80bd9d24df59d012ec46405380ebc99cdd19c72 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Plugin/Derivative/FieldUiLocalTask.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Plugin/Derivative/FieldUiLocalTask.php @@ -73,43 +73,43 @@ public static function create(ContainerInterface $container, $base_plugin_id) { public function getDerivativeDefinitions(array $base_plugin_definition) { $this->derivatives = array(); - foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) { - if ($entity_info->isFieldable() && $entity_info->hasLinkTemplate('admin-form')) { - $this->derivatives["overview_$entity_type"] = array( - 'route_name' => "field_ui.overview_$entity_type", + foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { + if ($entity_type->isFieldable() && $entity_type->hasLinkTemplate('admin-form')) { + $this->derivatives["overview_$entity_type_id"] = array( + 'route_name' => "field_ui.overview_$entity_type_id", 'weight' => 1, 'title' => $this->t('Manage fields'), - 'base_route' => "field_ui.overview_$entity_type", + 'base_route' => "field_ui.overview_$entity_type_id", ); // 'Manage form display' tab. - $this->derivatives["form_display_overview_$entity_type"] = array( - 'route_name' => "field_ui.form_display_overview_$entity_type", + $this->derivatives["form_display_overview_$entity_type_id"] = array( + 'route_name' => "field_ui.form_display_overview_$entity_type_id", 'weight' => 2, 'title' => $this->t('Manage form display'), - 'base_route' => "field_ui.overview_$entity_type", + 'base_route' => "field_ui.overview_$entity_type_id", ); // 'Manage display' tab. - $this->derivatives["display_overview_$entity_type"] = array( - 'route_name' => "field_ui.display_overview_$entity_type", + $this->derivatives["display_overview_$entity_type_id"] = array( + 'route_name' => "field_ui.display_overview_$entity_type_id", 'weight' => 3, 'title' => $this->t('Manage display'), - 'base_route' => "field_ui.overview_$entity_type", + 'base_route' => "field_ui.overview_$entity_type_id", ); // Field instance edit tab. - $this->derivatives["instance_edit_$entity_type"] = array( - 'route_name' => "field_ui.instance_edit_$entity_type", + $this->derivatives["instance_edit_$entity_type_id"] = array( + 'route_name' => "field_ui.instance_edit_$entity_type_id", 'title' => $this->t('Edit'), - 'base_route' => "field_ui.instance_edit_$entity_type", + 'base_route' => "field_ui.instance_edit_$entity_type_id", ); // Field settings tab. - $this->derivatives["field_edit_$entity_type"] = array( - 'route_name' => "field_ui.field_edit_$entity_type", + $this->derivatives["field_edit_$entity_type_id"] = array( + 'route_name' => "field_ui.field_edit_$entity_type_id", 'title' => $this->t('Field settings'), - 'base_route' => "field_ui.instance_edit_$entity_type", + 'base_route' => "field_ui.instance_edit_$entity_type_id", ); // View and form modes secondary tabs. @@ -119,41 +119,41 @@ public function getDerivativeDefinitions(array $base_plugin_definition) { // modes available for customisation. So we define menu items for all // view modes, and use a route requirement to determine which ones are // actually visible for a given bundle. - $this->derivatives['field_form_display_default_' . $entity_type] = array( + $this->derivatives['field_form_display_default_' . $entity_type_id] = array( 'title' => 'Default', - 'route_name' => "field_ui.form_display_overview_$entity_type", - 'parent_id' => "field_ui.fields:form_display_overview_$entity_type", + 'route_name' => "field_ui.form_display_overview_$entity_type_id", + 'parent_id' => "field_ui.fields:form_display_overview_$entity_type_id", ); - $this->derivatives['field_display_default_' . $entity_type] = array( + $this->derivatives['field_display_default_' . $entity_type_id] = array( 'title' => 'Default', - 'route_name' => "field_ui.display_overview_$entity_type", - 'parent_id' => "field_ui.fields:display_overview_$entity_type", + 'route_name' => "field_ui.display_overview_$entity_type_id", + 'parent_id' => "field_ui.fields:display_overview_$entity_type_id", ); // One local task for each form mode. $weight = 0; - foreach (entity_get_form_modes($entity_type) as $form_mode => $form_mode_info) { - $this->derivatives['field_form_display_' . $form_mode . '_' . $entity_type] = array( + foreach (entity_get_form_modes($entity_type_id) as $form_mode => $form_mode_info) { + $this->derivatives['field_form_display_' . $form_mode . '_' . $entity_type_id] = array( 'title' => $form_mode_info['label'], - 'route_name' => "field_ui.form_display_overview_form_mode_$entity_type", + 'route_name' => "field_ui.form_display_overview_form_mode_$entity_type_id", 'route_parameters' => array( 'form_mode_name' => $form_mode, ), - 'parent_id' => "field_ui.fields:form_display_overview_$entity_type", + 'parent_id' => "field_ui.fields:form_display_overview_$entity_type_id", 'weight' => $weight++, ); } // One local task for each view mode. $weight = 0; - foreach (entity_get_view_modes($entity_type) as $view_mode => $form_mode_info) { - $this->derivatives['field_display_' . $view_mode . '_' . $entity_type] = array( + foreach (entity_get_view_modes($entity_type_id) as $view_mode => $form_mode_info) { + $this->derivatives['field_display_' . $view_mode . '_' . $entity_type_id] = array( 'title' => $form_mode_info['label'], - 'route_name' => "field_ui.display_overview_view_mode_$entity_type", + 'route_name' => "field_ui.display_overview_view_mode_$entity_type_id", 'route_parameters' => array( 'view_mode_name' => $view_mode, ), - 'parent_id' => "field_ui.fields:display_overview_$entity_type", + 'parent_id' => "field_ui.fields:display_overview_$entity_type_id", 'weight' => $weight++, ); } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Routing/RouteSubscriber.php b/core/modules/field_ui/lib/Drupal/field_ui/Routing/RouteSubscriber.php index 2ec74381c295ea057bf379c5b370de758bb311ed..fbee6aa3b0f4b4f9daf4cccf84ed95f7607ba365 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Routing/RouteSubscriber.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Routing/RouteSubscriber.php @@ -39,11 +39,11 @@ public function __construct(EntityManagerInterface $manager) { * {@inheritdoc} */ protected function alterRoutes(RouteCollection $collection, $provider) { - foreach ($this->manager->getDefinitions() as $entity_type => $entity_info) { + foreach ($this->manager->getDefinitions() as $entity_type_id => $entity_type) { $defaults = array(); - if ($entity_info->isFieldable() && $entity_info->hasLinkTemplate('admin-form')) { + if ($entity_type->isFieldable() && $entity_type->hasLinkTemplate('admin-form')) { // Try to get the route from the current collection. - if (!$entity_route = $collection->get($entity_info->getLinkTemplate('admin-form'))) { + if (!$entity_route = $collection->get($entity_type->getLinkTemplate('admin-form'))) { continue; } $path = $entity_route->getPath(); @@ -54,28 +54,28 @@ protected function alterRoutes(RouteCollection $collection, $provider) { '_form' => '\Drupal\field_ui\Form\FieldInstanceEditForm', '_title_callback' => '\Drupal\field_ui\Form\FieldInstanceEditForm::getTitle', ), - array('_permission' => 'administer ' . $entity_type . ' fields') + array('_permission' => 'administer ' . $entity_type_id . ' fields') ); - $collection->add("field_ui.instance_edit_$entity_type", $route); + $collection->add("field_ui.instance_edit_$entity_type_id", $route); $route = new Route( "$path/fields/{field_instance}/field", array('_form' => '\Drupal\field_ui\Form\FieldEditForm'), - array('_permission' => 'administer ' . $entity_type . ' fields') + array('_permission' => 'administer ' . $entity_type_id . ' fields') ); - $collection->add("field_ui.field_edit_$entity_type", $route); + $collection->add("field_ui.field_edit_$entity_type_id", $route); $route = new Route( "$path/fields/{field_instance}/delete", array('_entity_form' => 'field_instance.delete'), - array('_field_ui_field_delete_access' => 'administer ' . $entity_type . ' fields') + array('_field_ui_field_delete_access' => 'administer ' . $entity_type_id . ' fields') ); - $collection->add("field_ui.delete_$entity_type", $route); + $collection->add("field_ui.delete_$entity_type_id", $route); // If the entity type has no bundles, use the entity type. - $defaults['entity_type'] = $entity_type; - if (!$entity_info->hasKey('bundle')) { - $defaults['bundle'] = $entity_type; + $defaults['entity_type_id'] = $entity_type_id; + if (!$entity_type->hasKey('bundle')) { + $defaults['bundle'] = $entity_type_id; } $route = new Route( "$path/fields", @@ -83,9 +83,9 @@ protected function alterRoutes(RouteCollection $collection, $provider) { '_form' => '\Drupal\field_ui\FieldOverview', '_title' => 'Manage fields', ) + $defaults, - array('_permission' => 'administer ' . $entity_type . ' fields') + array('_permission' => 'administer ' . $entity_type_id . ' fields') ); - $collection->add("field_ui.overview_$entity_type", $route); + $collection->add("field_ui.overview_$entity_type_id", $route); $route = new Route( "$path/form-display", @@ -93,18 +93,18 @@ protected function alterRoutes(RouteCollection $collection, $provider) { '_form' => '\Drupal\field_ui\FormDisplayOverview', '_title' => 'Manage form display', ) + $defaults, - array('_field_ui_form_mode_access' => 'administer ' . $entity_type . ' form display') + array('_field_ui_form_mode_access' => 'administer ' . $entity_type_id . ' form display') ); - $collection->add("field_ui.form_display_overview_$entity_type", $route); + $collection->add("field_ui.form_display_overview_$entity_type_id", $route); $route = new Route( "$path/form-display/{form_mode_name}", array( '_form' => '\Drupal\field_ui\FormDisplayOverview', ) + $defaults, - array('_field_ui_form_mode_access' => 'administer ' . $entity_type . ' form display') + array('_field_ui_form_mode_access' => 'administer ' . $entity_type_id . ' form display') ); - $collection->add("field_ui.form_display_overview_form_mode_$entity_type", $route); + $collection->add("field_ui.form_display_overview_form_mode_$entity_type_id", $route); $route = new Route( "$path/display", @@ -112,9 +112,9 @@ protected function alterRoutes(RouteCollection $collection, $provider) { '_form' => '\Drupal\field_ui\DisplayOverview', '_title' => 'Manage display', ) + $defaults, - array('_field_ui_view_mode_access' => 'administer ' . $entity_type . ' display') + array('_field_ui_view_mode_access' => 'administer ' . $entity_type_id . ' display') ); - $collection->add("field_ui.display_overview_$entity_type", $route); + $collection->add("field_ui.display_overview_$entity_type_id", $route); $route = new Route( "$path/display/{view_mode_name}", @@ -122,9 +122,9 @@ protected function alterRoutes(RouteCollection $collection, $provider) { '_form' => '\Drupal\field_ui\DisplayOverview', 'view_mode_name' => NULL, ) + $defaults, - array('_field_ui_view_mode_access' => 'administer ' . $entity_type . ' display') + array('_field_ui_view_mode_access' => 'administer ' . $entity_type_id . ' display') ); - $collection->add("field_ui.display_overview_view_mode_$entity_type", $route); + $collection->add("field_ui.display_overview_view_mode_$entity_type_id", $route); } } } diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 6bf4d29474d37527110f507a479a30ab20d436a6..f4e0f62eb42a4a1e92432b28ab4bbba863e975c5 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -1866,20 +1866,20 @@ function file_get_file_references(File $file, $field = NULL, $age = EntityStorag $references[$file->id()][$age] = array(); $usage_list = \Drupal::service('file.usage')->listUsage($file); $file_usage_list = isset($usage_list['file']) ? $usage_list['file'] : array(); - foreach ($file_usage_list as $entity_type => $entity_ids) { - $entity_info = \Drupal::entityManager()->getDefinition($entity_type); + foreach ($file_usage_list as $entity_type_id => $entity_ids) { + $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); // The usage table contains usage of every revision. If we are looking // for every revision or the entity does not support revisions then // every usage is already a match. - $match_entity_type = $age == EntityStorageControllerInterface::FIELD_LOAD_REVISION || !$entity_info->hasKey('revision'); - $entities = entity_load_multiple($entity_type, array_keys($entity_ids)); + $match_entity_type = $age == EntityStorageControllerInterface::FIELD_LOAD_REVISION || !$entity_type->hasKey('revision'); + $entities = entity_load_multiple($entity_type_id, array_keys($entity_ids)); foreach ($entities as $entity) { $bundle = $entity->bundle(); // We need to find file fields for this entity type and bundle. - if (!isset($file_fields[$entity_type][$bundle])) { - $file_fields[$entity_type][$bundle] = array(); + if (!isset($file_fields[$entity_type_id][$bundle])) { + $file_fields[$entity_type_id][$bundle] = array(); // This contains the possible field names. - $instances = field_info_instances($entity_type, $bundle); + $instances = field_info_instances($entity_type_id, $bundle); foreach ($instances as $field_name => $instance) { $field_type = $instance->getType(); // If this is the first time this field type is seen, check @@ -1889,11 +1889,11 @@ function file_get_file_references(File $file, $field = NULL, $age = EntityStorag } // If the field type does reference files then record it. if ($field_columns[$field_type]) { - $file_fields[$entity_type][$bundle][$field_name] = $field_columns[$field_type]; + $file_fields[$entity_type_id][$bundle][$field_name] = $field_columns[$field_type]; } } } - foreach ($file_fields[$entity_type][$bundle] as $field_name => $field_column) { + foreach ($file_fields[$entity_type_id][$bundle] as $field_name => $field_column) { $match = $match_entity_type; // If we didn't match yet then iterate over the field items to find // the referenced file. This will fail if the usage checked is in a @@ -1908,7 +1908,7 @@ function file_get_file_references(File $file, $field = NULL, $age = EntityStorag } } if ($match) { - $references[$file->id()][$age][$field_name][$entity_type][$entity->id()] = $entity; + $references[$file->id()][$age][$field_name][$entity_type_id][$entity->id()] = $entity; } } } @@ -1919,10 +1919,10 @@ function file_get_file_references(File $file, $field = NULL, $age = EntityStorag // cache is very small so this will be very fast. if ($field || $field_type) { foreach ($return as $field_name => $data) { - foreach (array_keys($data) as $entity_type) { - $current_field = field_info_field($entity_type, $field_name); + foreach (array_keys($data) as $entity_type_id) { + $current_field = field_info_field($entity_type_id, $field_name); if (($field_type && $current_field->getType() != $field_type) || ($field && $field->uuid() != $current_field->uuid())) { - unset($return[$field_name][$entity_type]); + unset($return[$field_name][$entity_type_id]); } } } diff --git a/core/modules/file/file.views.inc b/core/modules/file/file.views.inc index 4e51a871efad8894c0613abe499bade9615d5719..2da65b704802852f60f87108da8133ef55d30cd8 100644 --- a/core/modules/file/file.views.inc +++ b/core/modules/file/file.views.inc @@ -502,23 +502,23 @@ function file_field_views_data(FieldInterface $field) { * Views integration to provide reverse relationships on file fields. */ function file_field_views_data_views_data_alter(array &$data, FieldInterface $field) { - $entity_type = $field->entity_type; - $entity_info = \Drupal::entityManager()->getDefinition($entity_type); + $entity_type_id = $field->entity_type; + $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); $field_name = $field->getName(); - $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type; + $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type_id; - list($label) = field_views_field_label($entity_type, $field_name); + list($label) = field_views_field_label($entity_type_id, $field_name); $data['file_managed'][$pseudo_field_name]['relationship'] = array( - 'title' => t('@entity using @field', array('@entity' => $entity_info->getLabel(), '@field' => $label)), - 'help' => t('Relate each @entity with a @field set to the file.', array('@entity' => $entity_info->getLabel(), '@field' => $label)), + 'title' => t('@entity using @field', array('@entity' => $entity_type->getLabel(), '@field' => $label)), + 'help' => t('Relate each @entity with a @field set to the file.', array('@entity' => $entity_type->getLabel(), '@field' => $label)), 'id' => 'entity_reverse', 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'field table' => FieldableDatabaseStorageController::_fieldTableName($field), 'field field' => $field_name . '_target_id', - 'base' => $entity_info->getBaseTable(), - 'base field' => $entity_info->getKey('id'), + 'base' => $entity_type->getBaseTable(), + 'base field' => $entity_type->getKey('id'), 'label' => t('!field_name', array('!field_name' => $field_name)), 'join_extra' => array( 0 => array( diff --git a/core/modules/filter/lib/Drupal/filter/FilterFormatListController.php b/core/modules/filter/lib/Drupal/filter/FilterFormatListController.php index 3b70aea89faa029de1376a459cb281537a4a02b9..b83c0a960b5c53ef8101168f32e60b5f14dbd5ae 100644 --- a/core/modules/filter/lib/Drupal/filter/FilterFormatListController.php +++ b/core/modules/filter/lib/Drupal/filter/FilterFormatListController.php @@ -36,15 +36,15 @@ class FilterFormatListController extends DraggableListController implements Enti /** * Constructs a new FilterFormatListController. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The entity storage controller class. * @param \Drupal\Core\Config\ConfigFactory $config_factory * The config factory. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, ConfigFactory $config_factory) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage, ConfigFactory $config_factory) { + parent::__construct($entity_type, $storage); $this->configFactory = $config_factory; } @@ -52,10 +52,10 @@ public function __construct(EntityTypeInterface $entity_info, EntityStorageContr /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, - $container->get('entity.manager')->getStorageController($entity_info->id()), + $entity_type, + $container->get('entity.manager')->getStorageController($entity_type->id()), $container->get('config.factory') ); } diff --git a/core/modules/image/image.views.inc b/core/modules/image/image.views.inc index 083b507844e77f67bdfa244bf8ba01a2ffb6aa9a..81eaf16bb37b92303f6b081d81104eacc903a472 100644 --- a/core/modules/image/image.views.inc +++ b/core/modules/image/image.views.inc @@ -37,23 +37,23 @@ function image_field_views_data(FieldInterface $field) { * Views integration to provide reverse relationships on image fields. */ function image_field_views_data_views_data_alter(array &$data, FieldInterface $field) { - $entity_type = $field->entity_type; + $entity_type_id = $field->entity_type; $field_name = $field->getName(); - $entity_info = \Drupal::entityManager()->getDefinition($entity_type); - $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type; + $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); + $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type_id; - list($label) = field_views_field_label($entity_type, $field_name); + list($label) = field_views_field_label($entity_type_id, $field_name); $data['file_managed'][$pseudo_field_name]['relationship'] = array( - 'title' => t('@entity using @field', array('@entity' => $entity_info->getLabel(), '@field' => $label)), - 'help' => t('Relate each @entity with a @field set to the image.', array('@entity' => $entity_info->getLabel(), '@field' => $label)), + 'title' => t('@entity using @field', array('@entity' => $entity_type->getLabel(), '@field' => $label)), + 'help' => t('Relate each @entity with a @field set to the image.', array('@entity' => $entity_type->getLabel(), '@field' => $label)), 'id' => 'entity_reverse', 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'field table' => FieldableDatabaseStorageController::_fieldTableName($field), 'field field' => $field_name . '_target_id', - 'base' => $entity_info->getBaseTable(), - 'base field' => $entity_info->getKey('id'), + 'base' => $entity_type->getBaseTable(), + 'base field' => $entity_type->getKey('id'), 'label' => t('!field_name', array('!field_name' => $field_name)), 'join_extra' => array( 0 => array( diff --git a/core/modules/image/lib/Drupal/image/ImageStyleListController.php b/core/modules/image/lib/Drupal/image/ImageStyleListController.php index 568b5be51d6ab475c8e42519a7e8b8eb42575fd9..8d9de4d4724df088f37f6eed643221e0d13ce65e 100644 --- a/core/modules/image/lib/Drupal/image/ImageStyleListController.php +++ b/core/modules/image/lib/Drupal/image/ImageStyleListController.php @@ -31,25 +31,25 @@ class ImageStyleListController extends ConfigEntityListController implements Ent /** * Constructs a new ImageStyleListController object. * - * @param EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $image_style_storage * The image style entity storage controller class. * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator * The URL generator. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $image_style_storage, UrlGeneratorInterface $url_generator) { - parent::__construct($entity_info, $image_style_storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $image_style_storage, UrlGeneratorInterface $url_generator) { + parent::__construct($entity_type, $image_style_storage); $this->urlGenerator = $url_generator; } /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, - $container->get('entity.manager')->getStorageController($entity_info->id()), + $entity_type, + $container->get('entity.manager')->getStorageController($entity_type->id()), $container->get('url_generator'), $container->get('string_translation') ); diff --git a/core/modules/language/language.admin.inc b/core/modules/language/language.admin.inc index 79dc5d16913f05036a43521b2bb6fdb4a18e5234..3bd73f9c5cb88f3585b4efb68367bd8ab49fc36f 100644 --- a/core/modules/language/language.admin.inc +++ b/core/modules/language/language.admin.inc @@ -169,21 +169,21 @@ function language_content_settings_page() { * @ingroup forms */ function language_content_settings_form(array $form, array $form_state, array $supported) { - $entity_info = \Drupal::entityManager()->getDefinitions(); + $entity_types = \Drupal::entityManager()->getDefinitions(); $labels = array(); $default = array(); - foreach ($supported as $entity_type) { - $labels[$entity_type] = $entity_info[$entity_type]->getLabel() ?: $entity_type; - $default[$entity_type] = FALSE; + foreach ($supported as $entity_type_id) { + $labels[$entity_type_id] = $entity_types[$entity_type_id]->getLabel() ?: $entity_type_id; + $default[$entity_type_id] = FALSE; // Check whether we have any custom setting. - foreach (entity_get_bundles($entity_type) as $bundle => $bundle_info) { - $conf = language_get_default_configuration($entity_type, $bundle); + foreach (entity_get_bundles($entity_type_id) as $bundle => $bundle_info) { + $conf = language_get_default_configuration($entity_type_id, $bundle); if (!empty($conf['language_show']) || $conf['langcode'] != 'site_default') { - $default[$entity_type] = $entity_type; + $default[$entity_type_id] = $entity_type_id; } - $language_configuration[$entity_type][$bundle] = $conf; + $language_configuration[$entity_type_id][$bundle] = $conf; } } @@ -206,33 +206,33 @@ function language_content_settings_form(array $form, array $form_state, array $s $form['settings'] = array('#tree' => TRUE); - foreach ($labels as $entity_type => $label) { - $info = $entity_info[$entity_type]; + foreach ($labels as $entity_type_id => $label) { + $entity_type = $entity_types[$entity_type_id]; - $form['settings'][$entity_type] = array( + $form['settings'][$entity_type_id] = array( '#title' => $label, '#type' => 'container', - '#entity_type' => $entity_type, + '#entity_type' => $entity_type_id, '#theme' => 'language_content_settings_table', - '#bundle_label' => $info->getBundleLabel() ?: $label, + '#bundle_label' => $entity_type->getBundleLabel() ?: $label, '#states' => array( 'visible' => array( - ':input[name="entity_types[' . $entity_type . ']"]' => array('checked' => TRUE), + ':input[name="entity_types[' . $entity_type_id . ']"]' => array('checked' => TRUE), ), ), ); - foreach (entity_get_bundles($entity_type) as $bundle => $bundle_info) { - $form['settings'][$entity_type][$bundle]['settings'] = array( + foreach (entity_get_bundles($entity_type_id) as $bundle => $bundle_info) { + $form['settings'][$entity_type_id][$bundle]['settings'] = array( '#type' => 'item', '#label' => $bundle_info['label'], 'language' => array( '#type' => 'language_configuration', '#entity_information' => array( - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'bundle' => $bundle, ), - '#default_value' => $language_configuration[$entity_type][$bundle], + '#default_value' => $language_configuration[$entity_type_id][$bundle], ), ); } diff --git a/core/modules/language/language.module b/core/modules/language/language.module index 8d0faab0904bb6b64226526a6e92531963269e7c..5a7218b91d75d7cf002f65d1f4a9e9b3694fc7fb 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -162,9 +162,9 @@ function language_theme() { */ function language_entity_supported() { $supported = array(); - foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $info) { - if ($info->isTranslatable()) { - $supported[$entity_type] = $entity_type; + foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) { + if ($entity_type->isTranslatable()) { + $supported[$entity_type_id] = $entity_type_id; } } return $supported; diff --git a/core/modules/language/lib/Drupal/language/Form/ContentLanguageSettingsForm.php b/core/modules/language/lib/Drupal/language/Form/ContentLanguageSettingsForm.php index 7162eea2b3c7008d34b505a1dfc39d607322db03..c8b90f2d60a77feb7c8a0d04372644e7576e1536 100644 --- a/core/modules/language/lib/Drupal/language/Form/ContentLanguageSettingsForm.php +++ b/core/modules/language/lib/Drupal/language/Form/ContentLanguageSettingsForm.php @@ -56,9 +56,9 @@ public static function create(ContainerInterface $container) { */ protected function entitySupported() { $supported = array(); - foreach ($this->entityManager->getDefinitions() as $entity_type => $info) { - if ($info->isTranslatable()) { - $supported[$entity_type] = $entity_type; + foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { + if ($entity_type->isTranslatable()) { + $supported[$entity_type_id] = $entity_type_id; } } return $supported; @@ -75,23 +75,23 @@ public function getFormId() { * {@inheritdoc} */ public function buildForm(array $form, array &$form_state) { - $entity_info = $this->entityManager->getDefinitions(); + $entity_types = $this->entityManager->getDefinitions(); $labels = array(); $default = array(); $bundles = entity_get_bundles(); $language_configuration = array(); - foreach ($this->entitySupported() as $entity_type) { - $labels[$entity_type] = $entity_info[$entity_type]->getLabel() ?: $entity_type; - $default[$entity_type] = FALSE; + foreach ($this->entitySupported() as $entity_type_id) { + $labels[$entity_type_id] = $entity_types[$entity_type_id]->getLabel() ?: $entity_type_id; + $default[$entity_type_id] = FALSE; // Check whether we have any custom setting. foreach ($bundles as $bundle => $bundle_info) { - $conf = language_get_default_configuration($entity_type, $bundle); + $conf = language_get_default_configuration($entity_type_id, $bundle); if (!empty($conf['language_show']) || $conf['langcode'] != 'site_default') { - $default[$entity_type] = $entity_type; + $default[$entity_type_id] = $entity_type_id; } - $language_configuration[$entity_type][$bundle] = $conf; + $language_configuration[$entity_type_id][$bundle] = $conf; } } @@ -115,33 +115,33 @@ public function buildForm(array $form, array &$form_state) { $form['settings'] = array('#tree' => TRUE); - foreach ($labels as $entity_type => $label) { - $info = $entity_info[$entity_type]; + foreach ($labels as $entity_type_id => $label) { + $entity_type = $entity_types[$entity_type_id]; - $form['settings'][$entity_type] = array( + $form['settings'][$entity_type_id] = array( '#title' => $label, '#type' => 'container', - '#entity_type' => $entity_type, + '#entity_type' => $entity_type_id, '#theme' => 'language_content_settings_table', - '#bundle_label' => $info->getBundleLabel() ?: $label, + '#bundle_label' => $entity_type->getBundleLabel() ?: $label, '#states' => array( 'visible' => array( - ':input[name="entity_types[' . $entity_type . ']"]' => array('checked' => TRUE), + ':input[name="entity_types[' . $entity_type_id . ']"]' => array('checked' => TRUE), ), ), ); foreach ($bundles as $bundle => $bundle_info) { - $form['settings'][$entity_type][$bundle]['settings'] = array( + $form['settings'][$entity_type_id][$bundle]['settings'] = array( '#type' => 'item', '#label' => $bundle_info['label'], 'language' => array( '#type' => 'language_configuration', '#entity_information' => array( - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'bundle' => $bundle, ), - '#default_value' => $language_configuration[$entity_type][$bundle], + '#default_value' => $language_configuration[$entity_type_id][$bundle], ), ); } diff --git a/core/modules/locale/lib/Drupal/locale/ParamConverter/LocaleAdminPathConfigEntityConverter.php b/core/modules/locale/lib/Drupal/locale/ParamConverter/LocaleAdminPathConfigEntityConverter.php index 2eca5dda759fd68fd14abb253ae6e74e06a23fb6..00f1bd44c2d4a3ca0dc340d049fd3c5101f3c95e 100644 --- a/core/modules/locale/lib/Drupal/locale/ParamConverter/LocaleAdminPathConfigEntityConverter.php +++ b/core/modules/locale/lib/Drupal/locale/ParamConverter/LocaleAdminPathConfigEntityConverter.php @@ -70,9 +70,9 @@ public function applies($definition, $name, Route $route) { if (parent::applies($definition, $name, $route)) { // As we only want to override EntityConverter for ConfigEntities, find // out whether the current entity is a ConfigEntity. - $entity_type = substr($definition['type'], strlen('entity:')); - $info = $this->entityManager->getDefinition($entity_type); - if ($info->isSubclassOf('\Drupal\Core\Config\Entity\ConfigEntityInterface')) { + $entity_type_id = substr($definition['type'], strlen('entity:')); + $entity_type = $this->entityManager->getDefinition($entity_type_id); + if ($entity_type->isSubclassOf('\Drupal\Core\Config\Entity\ConfigEntityInterface')) { // path_is_admin() needs the path without the leading slash. $path = ltrim($route->getPath(), '/'); return path_is_admin($path); diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php index 9bd34ae43ff74bfc42d884d844cf3fecdde6f22a..d244a716460d3a7b5b1d16b1ec5d8f65f5214bd5 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php @@ -49,8 +49,8 @@ class MenuLinkStorageController extends DatabaseStorageController implements Men /** * Overrides DatabaseStorageController::__construct(). * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Database\Connection $database * The database connection to be used. * @param \Drupal\Component\Uuid\UuidInterface $uuid_service @@ -58,8 +58,8 @@ class MenuLinkStorageController extends DatabaseStorageController implements Men * @param \Symfony\Cmf\Component\Routing\RouteProviderInterface $route_provider * The route provider service. */ - public function __construct(EntityTypeInterface $entity_info, Connection $database, UuidInterface $uuid_service, RouteProviderInterface $route_provider) { - parent::__construct($entity_info, $database, $uuid_service); + public function __construct(EntityTypeInterface $entity_type, Connection $database, UuidInterface $uuid_service, RouteProviderInterface $route_provider) { + parent::__construct($entity_type, $database, $uuid_service); $this->routeProvider = $route_provider; @@ -83,9 +83,9 @@ public function create(array $values = array()) { /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('database'), $container->get('uuid'), $container->get('router.route_provider') diff --git a/core/modules/node/lib/Drupal/node/NodeAccessController.php b/core/modules/node/lib/Drupal/node/NodeAccessController.php index c2633530957542306a0123645b6d96b291003966..96204a48c42da5b8f9c8b83f07f576fd26c88ff1 100644 --- a/core/modules/node/lib/Drupal/node/NodeAccessController.php +++ b/core/modules/node/lib/Drupal/node/NodeAccessController.php @@ -34,22 +34,22 @@ class NodeAccessController extends EntityAccessController implements NodeAccessC /** * Constructs a NodeAccessController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\node\NodeGrantDatabaseStorageInterface $grant_storage * The node grant storage. */ - public function __construct(EntityTypeInterface $entity_info, NodeGrantDatabaseStorageInterface $grant_storage) { - parent::__construct($entity_info); + public function __construct(EntityTypeInterface $entity_type, NodeGrantDatabaseStorageInterface $grant_storage) { + parent::__construct($entity_type); $this->grantStorage = $grant_storage; } /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('node.grant_storage') ); } diff --git a/core/modules/node/lib/Drupal/node/NodeListController.php b/core/modules/node/lib/Drupal/node/NodeListController.php index 72a6b15fbd092c9722c4536f04ab1ed3e4a5b9b6..4ac1ebbbc4aff5006603028dc225817b2617fff6 100644 --- a/core/modules/node/lib/Drupal/node/NodeListController.php +++ b/core/modules/node/lib/Drupal/node/NodeListController.php @@ -32,15 +32,15 @@ class NodeListController extends EntityListController { /** * Constructs a new NodeListController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The entity storage controller class. * @param \Drupal\Core\Datetime\Date $date_service * The date service. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, Date $date_service) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage, Date $date_service) { + parent::__construct($entity_type, $storage); $this->dateService = $date_service; } @@ -48,10 +48,10 @@ public function __construct(EntityTypeInterface $entity_info, EntityStorageContr /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, - $container->get('entity.manager')->getStorageController($entity_info->id()), + $entity_type, + $container->get('entity.manager')->getStorageController($entity_type->id()), $container->get('date') ); } diff --git a/core/modules/node/lib/Drupal/node/NodeTypeListController.php b/core/modules/node/lib/Drupal/node/NodeTypeListController.php index 1549b8f53eca481d726cc690725f530bf2513fe7..b1829f682f8841d4ceb5dc72cad61e6f95fc0d8b 100644 --- a/core/modules/node/lib/Drupal/node/NodeTypeListController.php +++ b/core/modules/node/lib/Drupal/node/NodeTypeListController.php @@ -31,25 +31,25 @@ class NodeTypeListController extends ConfigEntityListController implements Entit /** * Constructs a NodeTypeFormController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The entity storage controller class. * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator * The url generator service. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, UrlGeneratorInterface $url_generator) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage, UrlGeneratorInterface $url_generator) { + parent::__construct($entity_type, $storage); $this->urlGenerator = $url_generator; } /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, - $container->get('entity.manager')->getStorageController($entity_info->id()), + $entity_type, + $container->get('entity.manager')->getStorageController($entity_type->id()), $container->get('url_generator') ); } diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php b/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php index 759b9938cd9c1ef27ed68450acd1d13a0cbb8e83..ffff6a5ca2b359b076382682cca6169bb6c7a3c4 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php @@ -255,7 +255,7 @@ protected function buildFilters(&$form, &$form_state) { // entities. If a particular entity type (i.e., bundle) has been // selected above, then we only search for taxonomy fields associated // with that bundle. Otherwise, we use all bundles. - $bundles = array_keys(entity_get_bundles($this->entity_type)); + $bundles = array_keys(entity_get_bundles($this->entityTypeId)); // Double check that this is a real bundle before using it (since above // we added a dummy option 'all' to the bundle list on the form). if (isset($selected_bundle) && in_array($selected_bundle, $bundles)) { @@ -263,8 +263,8 @@ protected function buildFilters(&$form, &$form_state) { } $tag_fields = array(); foreach ($bundles as $bundle) { - $display = entity_get_form_display($this->entity_type, $bundle, 'default'); - foreach (field_info_instances($this->entity_type, $bundle) as $field_name => $instance) { + $display = entity_get_form_display($this->entityTypeId, $bundle, 'default'); + foreach (field_info_instances($this->entityTypeId, $bundle) as $field_name => $instance) { $widget = $display->getComponent($field_name); // We define "tag-like" taxonomy fields as ones that use the // "Autocomplete term widget (tagging)" widget. @@ -293,12 +293,12 @@ protected function buildFilters(&$form, &$form_state) { '#title' => t('tagged with'), '#autocomplete_route_name' => 'taxonomy.autocomplete', '#autocomplete_route_parameters' => array( - 'entity_type' => $this->entity_type, + 'entity_type' => $this->entityTypeId, 'field_name' => $tag_field_name, ), '#size' => 30, '#maxlength' => 1024, - '#entity_type' => $this->entity_type, + '#entity_type' => $this->entityTypeId, '#field_name' => $tag_field_name, '#element_validate' => array('views_ui_taxonomy_autocomplete_validate'), ); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php index 5b7389a941f7235a2c86d59ddec35bb6531ce00e..6c9c6bdd8a90c5dcd5bfe25b23310da159b352a6 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php @@ -38,7 +38,7 @@ public static function getInfo() { } function setUp() { - $this->entityType = 'node'; + $this->entityTypeId = 'node'; $this->bundle = 'article'; parent::setUp(); @@ -110,7 +110,7 @@ protected function getFormSubmitAction(EntityInterface $entity) { * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::assertPublishedStatus(). */ protected function doTestPublishedStatus() { - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); $path = $entity->getSystemPath('edit-form'); $languages = language_list(); @@ -128,7 +128,7 @@ protected function doTestPublishedStatus() { } $this->drupalPostForm($path, array(), $action, array('language' => $languages[$langcode])); } - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); foreach ($this->langcodes as $langcode) { // The node is created as unpulished thus we switch to the published // status first. @@ -142,7 +142,7 @@ protected function doTestPublishedStatus() { * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::assertAuthoringInfo(). */ protected function doTestAuthoringInfo() { - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); $path = $entity->getSystemPath('edit-form'); $languages = language_list(); $values = array(); @@ -162,7 +162,7 @@ protected function doTestAuthoringInfo() { $this->drupalPostForm($path, $edit, $this->getFormSubmitAction($entity), array('language' => $languages[$langcode])); } - $entity = entity_load($this->entityType, $this->entityId, TRUE); + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); foreach ($this->langcodes as $langcode) { $this->assertEqual($entity->translation[$langcode]['uid'] == $values[$langcode]['uid'], 'Translation author correctly stored.'); $this->assertEqual($entity->translation[$langcode]['created'] == $values[$langcode]['created'], 'Translation date correctly stored.'); @@ -198,7 +198,7 @@ function testFieldTranslationForm() { $this->assertRaw('Not translated'); // Delete the only translatable field. - field_info_field($this->entityType, 'field_test_et_ui_test')->delete(); + field_info_field($this->entityTypeId, 'field_test_et_ui_test')->delete(); // Visit translation page. $this->drupalGet('node/' . $article->id() . '/translations'); @@ -230,7 +230,7 @@ function testTranslationRendering() { $default_langcode = $this->langcodes[0]; $values[$default_langcode] = $this->getNewEntityValues($default_langcode); $this->entityId = $this->createEntity($values[$default_langcode], $default_langcode); - $node = \Drupal::entityManager()->getStorageController($this->entityType)->load($this->entityId); + $node = \Drupal::entityManager()->getStorageController($this->entityTypeId)->load($this->entityId); $node->setPromoted(TRUE); // Create translations. diff --git a/core/modules/rest/lib/Drupal/rest/LinkManager/TypeLinkManager.php b/core/modules/rest/lib/Drupal/rest/LinkManager/TypeLinkManager.php index 1d76bde4b8e58780d797790c16674944f39a22d4..81f51742e77a459a45b62df206a4bfd52ac0752d 100644 --- a/core/modules/rest/lib/Drupal/rest/LinkManager/TypeLinkManager.php +++ b/core/modules/rest/lib/Drupal/rest/LinkManager/TypeLinkManager.php @@ -81,18 +81,18 @@ protected function writeCache() { // Type URIs correspond to bundles. Iterate through the bundles to get the // URI and data for them. - $entity_info = \Drupal::entityManager()->getDefinitions(); - foreach (entity_get_bundles() as $entity_type => $bundles) { + $entity_types = \Drupal::entityManager()->getDefinitions(); + foreach (entity_get_bundles() as $entity_type_id => $bundles) { // Only content entities are supported currently. // @todo Consider supporting config entities. - if ($entity_info[$entity_type]->isSubclassOf('\Drupal\Core\Config\Entity\ConfigEntityInterface')) { + if ($entity_types[$entity_type_id]->isSubclassOf('\Drupal\Core\Config\Entity\ConfigEntityInterface')) { continue; } foreach ($bundles as $bundle => $bundle_info) { // Get a type URI for the bundle. - $bundle_uri = $this->getTypeUri($entity_type, $bundle); + $bundle_uri = $this->getTypeUri($entity_type_id, $bundle); $data[$bundle_uri] = array( - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'bundle' => $bundle, ); } diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/Derivative/EntityDerivative.php b/core/modules/rest/lib/Drupal/rest/Plugin/Derivative/EntityDerivative.php index 3723287b5602a1c9c69c3fa733fbf14022405752..2b3cf222a81a59e061fff519a6ca2798b7262518 100644 --- a/core/modules/rest/lib/Drupal/rest/Plugin/Derivative/EntityDerivative.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/Derivative/EntityDerivative.php @@ -67,14 +67,14 @@ public function getDerivativeDefinition($derivative_id, array $base_plugin_defin public function getDerivativeDefinitions(array $base_plugin_definition) { if (!isset($this->derivatives)) { // Add in the default plugin configuration and the resource type. - foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) { - $this->derivatives[$entity_type] = array( - 'id' => 'entity:' . $entity_type, - 'entity_type' => $entity_type, - 'serialization_class' => $entity_info->getClass(), - 'label' => $entity_info->getLabel(), + foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { + $this->derivatives[$entity_type_id] = array( + 'id' => 'entity:' . $entity_type_id, + 'entity_type' => $entity_type_id, + 'serialization_class' => $entity_type->getClass(), + 'label' => $entity_type->getLabel(), ); - $this->derivatives[$entity_type] += $base_plugin_definition; + $this->derivatives[$entity_type_id] += $base_plugin_definition; } } return $this->derivatives; diff --git a/core/modules/search/lib/Drupal/search/SearchPageListController.php b/core/modules/search/lib/Drupal/search/SearchPageListController.php index 4586a6b954e03625945ad8a41544466aaf93a41c..8c69ac0ce18331050ef8ec7b99e35b5c30f8985c 100644 --- a/core/modules/search/lib/Drupal/search/SearchPageListController.php +++ b/core/modules/search/lib/Drupal/search/SearchPageListController.php @@ -45,8 +45,8 @@ class SearchPageListController extends DraggableListController implements FormIn /** * Constructs a new SearchPageListController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The entity storage controller class. * @param \Drupal\search\SearchPluginManager $search_manager @@ -54,8 +54,8 @@ class SearchPageListController extends DraggableListController implements FormIn * @param \Drupal\Core\Config\ConfigFactory $config_factory * The factory for configuration objects. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, SearchPluginManager $search_manager, ConfigFactory $config_factory) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage, SearchPluginManager $search_manager, ConfigFactory $config_factory) { + parent::__construct($entity_type, $storage); $this->configFactory = $config_factory; $this->searchManager = $search_manager; } @@ -63,10 +63,10 @@ public function __construct(EntityTypeInterface $entity_info, EntityStorageContr /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, - $container->get('entity.manager')->getStorageController($entity_info->id()), + $entity_type, + $container->get('entity.manager')->getStorageController($entity_type->id()), $container->get('plugin.manager.search'), $container->get('config.factory') ); diff --git a/core/modules/search/lib/Drupal/search/SearchPageRepository.php b/core/modules/search/lib/Drupal/search/SearchPageRepository.php index 24e7eee2510e2e26fe44a912394ddbd21f0c17db..680d45c95a821d11af515c6b8958278d6ad2aac5 100644 --- a/core/modules/search/lib/Drupal/search/SearchPageRepository.php +++ b/core/modules/search/lib/Drupal/search/SearchPageRepository.php @@ -109,8 +109,8 @@ public function setDefaultSearchPage(SearchPageInterface $search_page) { * {@inheritdoc} */ public function sortSearchPages($search_pages) { - $entity_info = $this->storage->getEntityType(); - uasort($search_pages, array($entity_info->getClass(), 'sort')); + $entity_type = $this->storage->getEntityType(); + uasort($search_pages, array($entity_type->getClass(), 'sort')); return $search_pages; } diff --git a/core/modules/serialization/lib/Drupal/serialization/Normalizer/EntityNormalizer.php b/core/modules/serialization/lib/Drupal/serialization/Normalizer/EntityNormalizer.php index 2e433525d8f517490962c98ccfdb87c2215fade2..5ab0c966c8b28a46c8068784f596f1de5ec9e68d 100644 --- a/core/modules/serialization/lib/Drupal/serialization/Normalizer/EntityNormalizer.php +++ b/core/modules/serialization/lib/Drupal/serialization/Normalizer/EntityNormalizer.php @@ -60,12 +60,12 @@ public function denormalize($data, $class, $format = NULL, array $context = arra throw new UnexpectedValueException('Entity type parameter must be included in context.'); } - $entity_info = $this->entityManager->getDefinition($context['entity_type']); + $entity_type = $this->entityManager->getDefinition($context['entity_type']); // The bundle property behaves differently from other entity properties. // i.e. the nested structure with a 'value' key does not work. - if ($entity_info->hasKey('bundle')) { - $bundle_key = $entity_info->getKey('bundle'); + if ($entity_type->hasKey('bundle')) { + $bundle_key = $entity_type->getKey('bundle'); $type = $data[$bundle_key][0]['value']; $data[$bundle_key] = $type; } diff --git a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutAccessController.php b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutAccessController.php index 79683b8e7595350d665804bbc4318da1e55737c0..45d37313c4336a350ba137c590ee67c38712e552 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutAccessController.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutAccessController.php @@ -29,22 +29,22 @@ class ShortcutAccessController extends EntityAccessController implements EntityC /** * Constructs a ShortcutAccessController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\shortcut\ShortcutSetStorageController $shortcut_set_storage * The shortcut_set storage controller. */ - public function __construct(EntityTypeInterface $entity_info, ShortcutSetStorageController $shortcut_set_storage) { - parent::__construct($entity_info); + public function __construct(EntityTypeInterface $entity_type, ShortcutSetStorageController $shortcut_set_storage) { + parent::__construct($entity_type); $this->shortcutSetStorage = $shortcut_set_storage; } /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('entity.manager')->getStorageController('shortcut_set') ); } diff --git a/core/modules/system/entity.api.php b/core/modules/system/entity.api.php index 1e37fffcbf7eabf5356ddefb91977d4244b8c286..928d292bed6bca479752ce022af271c7233ab239 100644 --- a/core/modules/system/entity.api.php +++ b/core/modules/system/entity.api.php @@ -191,12 +191,12 @@ function hook_entity_bundle_info_alter(&$bundles) { * * This hook is invoked after the operation has been performed. * - * @param string $entity_type + * @param string $entity_type_id * The type of $entity; e.g. 'node' or 'user'. * @param string $bundle * The name of the bundle. */ -function hook_entity_bundle_create($entity_type, $bundle) { +function hook_entity_bundle_create($entity_type_id, $bundle) { // When a new bundle is created, the menu needs to be rebuilt to add the // Field UI menu item tabs. \Drupal::service('router.builder')->setRebuildNeeded(); @@ -207,20 +207,20 @@ function hook_entity_bundle_create($entity_type, $bundle) { * * This hook is invoked after the operation has been performed. * - * @param string $entity_type + * @param string $entity_type_id * The entity type to which the bundle is bound. * @param string $bundle_old * The previous name of the bundle. * @param string $bundle_new * The new name of the bundle. */ -function hook_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) { +function hook_entity_bundle_rename($entity_type_id, $bundle_old, $bundle_new) { // Update the settings associated with the bundle in my_module.settings. $config = \Drupal::config('my_module.settings'); $bundle_settings = $config->get('bundle_settings'); - if (isset($bundle_settings[$entity_type][$bundle_old])) { - $bundle_settings[$entity_type][$bundle_new] = $bundle_settings[$entity_type][$bundle_old]; - unset($bundle_settings[$entity_type][$bundle_old]); + if (isset($bundle_settings[$entity_type_id][$bundle_old])) { + $bundle_settings[$entity_type_id][$bundle_new] = $bundle_settings[$entity_type_id][$bundle_old]; + unset($bundle_settings[$entity_type_id][$bundle_old]); $config->set('bundle_settings', $bundle_settings); } } @@ -230,17 +230,17 @@ function hook_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) { * * This hook is invoked after the operation has been performed. * - * @param string $entity_type + * @param string $entity_type_id * The type of entity; for example, 'node' or 'user'. * @param string $bundle * The bundle that was just deleted. */ -function hook_entity_bundle_delete($entity_type, $bundle) { +function hook_entity_bundle_delete($entity_type_id, $bundle) { // Remove the settings associated with the bundle in my_module.settings. $config = \Drupal::config('my_module.settings'); $bundle_settings = $config->get('bundle_settings'); - if (isset($bundle_settings[$entity_type][$bundle])) { - unset($bundle_settings[$entity_type][$bundle]); + if (isset($bundle_settings[$entity_type_id][$bundle])) { + unset($bundle_settings[$entity_type_id][$bundle]); $config->set('bundle_settings', $bundle_settings); } } @@ -268,10 +268,10 @@ function hook_entity_create(\Drupal\Core\Entity\EntityInterface $entity) { * * @param array $entities * The entities keyed by entity ID. - * @param string $entity_type + * @param string $entity_type_id * The type of entities being loaded (i.e. node, user, comment). */ -function hook_entity_load($entities, $entity_type) { +function hook_entity_load($entities, $entity_type_id) { foreach ($entities as $entity) { $entity->foo = mymodule_add_something($entity); } @@ -510,7 +510,7 @@ function hook_entity_view_alter(&$build, Drupal\Core\Entity\EntityInterface $ent * view. Only use this if attaching the data during the entity loading phase * is not appropriate, for example when attaching other 'entity' style objects. * - * @param string $entity_type + * @param string $entity_type_id * The type of entities being viewed (i.e. node, user, comment). * @param array $entities * The entities keyed by entity ID. @@ -520,9 +520,9 @@ function hook_entity_view_alter(&$build, Drupal\Core\Entity\EntityInterface $ent * @param string $view_mode * The view mode. */ -function hook_entity_prepare_view($entity_type, array $entities, array $displays, $view_mode) { +function hook_entity_prepare_view($entity_type_id, array $entities, array $displays, $view_mode) { // Load a specific node into the user object for later theming. - if (!empty($entities) && $entity_type == 'user') { + if (!empty($entities) && $entity_type_id == 'user') { // Only do the extra work if the component is configured to be // displayed. This assumes a 'mymodule_addition' extra field has been // defined for the entity bundle in hook_field_extra_fields(). @@ -632,7 +632,7 @@ function hook_entity_form_display_alter(\Drupal\Core\Entity\Display\EntityFormDi /** * Define custom entity fields. * - * @param string $entity_type + * @param string $entity_type_id * The entity type for which to define entity fields. * * @return array @@ -650,8 +650,8 @@ function hook_entity_form_display_alter(\Drupal\Core\Entity\Display\EntityFormDi * @see \Drupal\Core\Entity\EntityManagerInterface::getFieldDefinitions() * @see \Drupal\Core\TypedData\TypedDataManager::create() */ -function hook_entity_field_info($entity_type) { - if (mymodule_uses_entity_type($entity_type)) { +function hook_entity_field_info($entity_type_id) { + if (mymodule_uses_entity_type($entity_type_id)) { $info = array(); $info['definitions']['mymodule_text'] = FieldDefinition::create('string') ->setLabel(t('The text')) @@ -659,7 +659,7 @@ function hook_entity_field_info($entity_type) { ->setComputed(TRUE) ->setClass('\Drupal\mymodule\EntityComputedText'); - if ($entity_type == 'node') { + if ($entity_type_id == 'node') { // Add a property only to entities of the 'article' bundle. $info['optional']['mymodule_text_more'] = FieldDefinition::create('string') ->setLabel(t('More text')) @@ -677,12 +677,12 @@ function hook_entity_field_info($entity_type) { * * @param array $info * The entity field info array as returned by hook_entity_field_info(). - * @param string $entity_type + * @param string $entity_type_id * The entity type for which entity fields are defined. * * @see hook_entity_field_info() */ -function hook_entity_field_info_alter(&$info, $entity_type) { +function hook_entity_field_info_alter(&$info, $entity_type_id) { if (!empty($info['definitions']['mymodule_text'])) { // Alter the mymodule_text field to use a custom class. $info['definitions']['mymodule_text']->setClass('\Drupal\anothermodule\EntityComputedText'); diff --git a/core/modules/system/lib/Drupal/system/DateFormatListController.php b/core/modules/system/lib/Drupal/system/DateFormatListController.php index 85d63d9695c33fa372ea093b1c08701fd641a03b..9472d8c4194b6614cb33a6d7752d34a6899924bb 100644 --- a/core/modules/system/lib/Drupal/system/DateFormatListController.php +++ b/core/modules/system/lib/Drupal/system/DateFormatListController.php @@ -30,15 +30,15 @@ class DateFormatListController extends ConfigEntityListController { /** * Constructs a new DateFormatListController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The entity storage controller class. * @param \Drupal\Core\Datetime\Date $date_service * The date service. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, Date $date_service) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage, Date $date_service) { + parent::__construct($entity_type, $storage); $this->dateService = $date_service; } @@ -46,10 +46,10 @@ public function __construct(EntityTypeInterface $entity_info, EntityStorageContr /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, - $container->get('entity.manager')->getStorageController($entity_info->id()), + $entity_type, + $container->get('entity.manager')->getStorageController($entity_type->id()), $container->get('date') ); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php index 4d3633857b5e920e69be708eeb5a66a817870087..93fd5543c1aa41543e335646d97142e7e8ff01cd 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php @@ -27,22 +27,22 @@ public static function getInfo() { */ function testEntityInfoChanges() { \Drupal::moduleHandler()->install(array('entity_cache_test')); - $entity_info = \Drupal::entityManager()->getDefinitions(); - $this->assertTrue(isset($entity_info['entity_cache_test']), 'Test entity type found.'); + $entity_types = \Drupal::entityManager()->getDefinitions(); + $this->assertTrue(isset($entity_types['entity_cache_test']), 'Test entity type found.'); // Change the label of the test entity type and make sure changes appear // after flushing caches. \Drupal::state()->set('entity_cache_test.label', 'New label.'); - $info = \Drupal::entityManager()->getDefinition('entity_cache_test'); - $this->assertEqual($info->getLabel(), 'Entity Cache Test', 'Original label appears in cached entity info.'); + $entity_type = \Drupal::entityManager()->getDefinition('entity_cache_test'); + $this->assertEqual($entity_type->getLabel(), 'Entity Cache Test', 'Original label appears in cached entity info.'); $this->resetAll(); - $info = \Drupal::entityManager()->getDefinition('entity_cache_test'); - $this->assertEqual($info->getLabel(), 'New label.', 'New label appears in entity info.'); + $entity_type = \Drupal::entityManager()->getDefinition('entity_cache_test'); + $this->assertEqual($entity_type->getLabel(), 'New label.', 'New label appears in entity info.'); // Uninstall the providing module and make sure the entity type is gone. module_uninstall(array('entity_cache_test', 'entity_cache_test_dependency')); - $entity_info = \Drupal::entityManager()->getDefinitions(); - $this->assertFalse(isset($entity_info['entity_cache_test']), 'Entity type of the providing module is gone.'); + $entity_types = \Drupal::entityManager()->getDefinitions(); + $this->assertFalse(isset($entity_types['entity_cache_test']), 'Entity type of the providing module is gone.'); } /** @@ -52,8 +52,8 @@ function testEntityInfoChanges() { */ function testEntityInfoCacheWatchdog() { \Drupal::moduleHandler()->install(array('entity_cache_test')); - $info = \Drupal::state()->get('entity_cache_test'); - $this->assertEqual($info->getLabel(), 'Entity Cache Test', 'Entity info label is correct.'); - $this->assertEqual($info->getStorageClass(), 'Drupal\Core\Entity\DatabaseStorageController', 'Entity controller class info is correct.'); + $entity_type = \Drupal::state()->get('entity_cache_test'); + $this->assertEqual($entity_type->getLabel(), 'Entity Cache Test', 'Entity info label is correct.'); + $this->assertEqual($entity_type->getStorageClass(), 'Drupal\Core\Entity\DatabaseStorageController', 'Entity controller class info is correct.'); } } diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module index b36cf8ba3d193b02a69ff513737a2f069ae7cf55..a46a1e79853b4448b8b8899f9e0efcd6ca6c3cec 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.module +++ b/core/modules/system/tests/modules/entity_test/entity_test.module @@ -145,10 +145,10 @@ function entity_test_delete_bundle($bundle, $entity_type = 'entity_test') { */ function entity_test_entity_bundle_info() { $bundles = array(); - $entity_info = \Drupal::entityManager()->getDefinitions(); - foreach ($entity_info as $entity_type => $info) { - if ($info->getProvider() == 'entity_test') { - $bundles[$entity_type] = \Drupal::state()->get($entity_type . '.bundles') ?: array($entity_type => array('label' => 'Entity Test Bundle')); + $entity_types = \Drupal::entityManager()->getDefinitions(); + foreach ($entity_types as $entity_type_id => $entity_type) { + if ($entity_type->getProvider() == 'entity_test') { + $bundles[$entity_type_id] = \Drupal::state()->get($entity_type_id . '.bundles') ?: array($entity_type_id => array('label' => 'Entity Test Bundle')); } } return $bundles; diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php index 61e10c315f543e0b8c337fdb0bc1d779ecfbe41c..749ee44b0ebd0983991802664da1a354f25ed765 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php @@ -49,8 +49,7 @@ public function form(array $form, array &$form_state) { ); // @todo: Is there a better way to check if an entity type is revisionable? - $entity_info = $entity->getEntityType(); - if ($entity_info->hasKey('revision') && !$entity->isNew()) { + if ($entity->getEntityType()->hasKey('revision') && !$entity->isNew()) { $form['revision'] = array( '#type' => 'checkbox', '#title' => t('Create new revision'), diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php index b0a2865aa58489a958a926aa5c6cdd0388b613b7..6063e94a9e24e181a4caebefa66f2b6b259768cb 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php @@ -43,7 +43,7 @@ public static function getInfo() { } function setUp() { - $this->entityType = 'taxonomy_term'; + $this->entityTypeId = 'taxonomy_term'; $this->bundle = 'tags'; $this->name = $this->randomName(); parent::setUp(); diff --git a/core/modules/taxonomy/taxonomy.views.inc b/core/modules/taxonomy/taxonomy.views.inc index bc041a0c263eceab3558816d1e0ae5aca7a1dc94..c43c36482c2061ef04d963a535ad1a16f3b32ece 100644 --- a/core/modules/taxonomy/taxonomy.views.inc +++ b/core/modules/taxonomy/taxonomy.views.inc @@ -436,22 +436,22 @@ function taxonomy_field_views_data(FieldInterface $field) { */ function taxonomy_field_views_data_views_data_alter(array &$data, FieldInterface $field) { $field_name = $field->getName(); - $entity_type = $field->entity_type; - $entity_info = \Drupal::entityManager()->getDefinition($entity_type); - $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type; + $entity_type_id = $field->entity_type; + $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); + $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type_id; - list($label) = field_views_field_label($entity_type, $field_name); + list($label) = field_views_field_label($entity_type_id, $field_name); $data['taxonomy_term_data'][$pseudo_field_name]['relationship'] = array( - 'title' => t('@entity using @field', array('@entity' => $entity_info->getLabel(), '@field' => $label)), - 'help' => t('Relate each @entity with a @field set to the term.', array('@entity' => $entity_info->getLabel(), '@field' => $label)), + 'title' => t('@entity using @field', array('@entity' => $entity_type->getLabel(), '@field' => $label)), + 'help' => t('Relate each @entity with a @field set to the term.', array('@entity' => $entity_type->getLabel(), '@field' => $label)), 'id' => 'entity_reverse', 'field_name' => $field_name, - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'field table' => FieldableDatabaseStorageController::_fieldTableName($field), 'field field' => $field_name . '_target_id', - 'base' => $entity_info->getBaseTable(), - 'base field' => $entity_info->getKey('id'), + 'base' => $entity_type->getBaseTable(), + 'base field' => $entity_type->getKey('id'), 'label' => t('!field_name', array('!field_name' => $field_name)), 'join_extra' => array( 0 => array( diff --git a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php index f2af023f6f4bc66c0fb8b669d5064a16a4ef8922..82b20437092204a56ec10fe15fa4c487306db7a9 100644 --- a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php @@ -105,8 +105,8 @@ function setUp() { * The created entity object. */ protected function createEntity($values = array()) { - $info = \Drupal::entityManager()->getDefinition($this->entity_type); - $bundle_key = $info->getKey('bundle'); + $entity_type = \Drupal::entityManager()->getDefinition($this->entity_type); + $bundle_key = $entity_type->getKey('bundle'); $entity = entity_create($this->entity_type, $values + array( $bundle_key => $this->bundle, )); diff --git a/core/modules/user/lib/Drupal/user/Controller/UserListController.php b/core/modules/user/lib/Drupal/user/Controller/UserListController.php index a928b55999b37f29dc9dce60a9f2bbfef86e144a..72c1a84cba457c0d27a44d224c7b5278417ed072 100644 --- a/core/modules/user/lib/Drupal/user/Controller/UserListController.php +++ b/core/modules/user/lib/Drupal/user/Controller/UserListController.php @@ -32,25 +32,25 @@ class UserListController extends EntityListController implements EntityControlle /** * Constructs a new UserListController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The entity storage controller class. * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory * The entity query factory. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, QueryFactory $query_factory) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage, QueryFactory $query_factory) { + parent::__construct($entity_type, $storage); $this->queryFactory = $query_factory; } /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, - $container->get('entity.manager')->getStorageController($entity_info->id()), + $entity_type, + $container->get('entity.manager')->getStorageController($entity_type->id()), $container->get('entity.query') ); } diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php b/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php index 0b7883f7f306a1b2773319247104dc9b37075ab9..22ff1f95e04fc838a067b84c116b06a6d19a76f1 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php @@ -35,7 +35,7 @@ public static function getInfo() { } function setUp() { - $this->entityType = 'user'; + $this->entityTypeId = 'user'; $this->testLanguageSelector = FALSE; $this->name = $this->randomName(); parent::setUp(); diff --git a/core/modules/user/lib/Drupal/user/UserStorageController.php b/core/modules/user/lib/Drupal/user/UserStorageController.php index 6093e7ed5e20225191841439393d911b0286b5d0..06940192d33f74c246bab4daaa5f0527e20bdc52 100644 --- a/core/modules/user/lib/Drupal/user/UserStorageController.php +++ b/core/modules/user/lib/Drupal/user/UserStorageController.php @@ -42,8 +42,8 @@ class UserStorageController extends FieldableDatabaseStorageController implement /** * Constructs a new UserStorageController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * The entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Database\Connection $database * The database connection to be used. * @param \Drupal\field\FieldInfo $field_info @@ -55,8 +55,8 @@ class UserStorageController extends FieldableDatabaseStorageController implement * @param \Drupal\user\UserDataInterface $user_data * The user data service. */ - public function __construct(EntityTypeInterface $entity_info, Connection $database, FieldInfo $field_info, UuidInterface $uuid_service, PasswordInterface $password, UserDataInterface $user_data) { - parent::__construct($entity_info, $database, $field_info, $uuid_service); + public function __construct(EntityTypeInterface $entity_type, Connection $database, FieldInfo $field_info, UuidInterface $uuid_service, PasswordInterface $password, UserDataInterface $user_data) { + parent::__construct($entity_type, $database, $field_info, $uuid_service); $this->password = $password; $this->userData = $user_data; @@ -65,9 +65,9 @@ public function __construct(EntityTypeInterface $entity_info, Connection $databa /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, + $entity_type, $container->get('database'), $container->get('field.info'), $container->get('uuid'), diff --git a/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsEntityArgumentValidator.php b/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsEntityArgumentValidator.php index b5f026d21c7daf2f055550fd676a52cfeee97630..eb2f383f0851d577f5d81038ecda40efb77b2a18 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsEntityArgumentValidator.php +++ b/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsEntityArgumentValidator.php @@ -80,15 +80,15 @@ public static function create(ContainerInterface $container, $base_plugin_id) { * {@inheritdoc} */ public function getDerivativeDefinitions(array $base_plugin_definition) { - $entity_info = $this->entityManager->getDefinitions(); + $entity_types = $this->entityManager->getDefinitions(); $this->derivatives = array(); - foreach ($entity_info as $entity_type => $entity_info) { - $this->derivatives[$entity_type] = array( - 'id' => 'entity:' . $entity_type, + foreach ($entity_types as $entity_type_id => $entity_type) { + $this->derivatives[$entity_type_id] = array( + 'id' => 'entity:' . $entity_type_id, 'provider' => 'views', - 'title' => $entity_info->getLabel(), - 'help' => $this->t('Validate @label', array('@label' => $entity_info->getLabel())), - 'entity_type' => $entity_type, + 'title' => $entity_type->getLabel(), + 'help' => $this->t('Validate @label', array('@label' => $entity_type->getLabel())), + 'entity_type' => $entity_type_id, 'class' => $base_plugin_definition['class'], ); } diff --git a/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsEntityRow.php b/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsEntityRow.php index 5058364cbd500d2fee56be6e46ffcfaa6fcb784c..c82a88b3df6b2472de48d6c2670417f15daaebff 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsEntityRow.php +++ b/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsEntityRow.php @@ -91,16 +91,16 @@ public function getDerivativeDefinition($derivative_id, array $base_plugin_defin * {@inheritdoc} */ public function getDerivativeDefinitions(array $base_plugin_definition) { - foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) { + foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { // Just add support for entity types which have a views integration. - if (($base_table = $entity_info->getBaseTable()) && $this->viewsData->get($base_table) && $this->entityManager->hasController($entity_type, 'view_builder')) { - $this->derivatives[$entity_type] = array( - 'id' => 'entity:' . $entity_type, + if (($base_table = $entity_type->getBaseTable()) && $this->viewsData->get($base_table) && $this->entityManager->hasController($entity_type_id, 'view_builder')) { + $this->derivatives[$entity_type_id] = array( + 'id' => 'entity:' . $entity_type_id, 'provider' => 'views', - 'title' => $entity_info->getLabel(), - 'help' => t('Display the @label', array('@label' => $entity_info->getLabel())), + 'title' => $entity_type->getLabel(), + 'help' => t('Display the @label', array('@label' => $entity_type->getLabel())), 'base' => array($base_table), - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'display_types' => array('normal'), 'class' => $base_plugin_definition['class'], ); diff --git a/core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/ViewsSelection.php b/core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/ViewsSelection.php index 7fef5b22b592fee76f5fe1d17badc9fca099d71e..05e97d9a33c5887aca649cb2503eb62dda328066 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/ViewsSelection.php +++ b/core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/ViewsSelection.php @@ -62,11 +62,11 @@ public static function settingsForm(FieldDefinitionInterface $field_definition) $displays = views_get_applicable_views('entity_reference_display'); // Filter views that list the entity type we want, and group the separate // displays by view. - $entity_info = \Drupal::entityManager()->getDefinition($field_definition->getSetting('target_type')); + $entity_type = \Drupal::entityManager()->getDefinition($field_definition->getSetting('target_type')); $options = array(); foreach ($displays as $data) { list($view, $display_id) = $data; - if ($view->storage->get('base_table') == $entity_info->getBaseTable()) { + if ($view->storage->get('base_table') == $entity_type->getBaseTable()) { $name = $view->storage->get('id'); $display = $view->storage->get('display'); $options[$name . ':' . $display_id] = $name . ' - ' . $display[$display_id]['display_title']; diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument_validator/Entity.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument_validator/Entity.php index 1d1d9587add732fb4ccd02cde4fa2328c4cb1f48..d5daf4b2d0bf63f9d51cab4234db6cc48e66175c 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/argument_validator/Entity.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument_validator/Entity.php @@ -86,23 +86,23 @@ protected function defineOptions() { public function buildOptionsForm(&$form, &$form_state) { parent::buildOptionsForm($form, $form_state); - $entity_type = $this->definition['entity_type']; + $entity_type_id = $this->definition['entity_type']; // Derivative IDs are all entity:entity_type. Sanitized for js. // The ID is converted back on submission. $sanitized_id = ArgumentPluginBase::encodeValidatorId($this->definition['id']); - $entity_info = $this->entityManager->getDefinition($entity_type); - $bundle_type = $entity_info->getKey('bundle'); + $entity_type = $this->entityManager->getDefinition($entity_type_id); + $bundle_type = $entity_type->getKey('bundle'); // If the entity has bundles, allow option to restrict to bundle(s). if ($bundle_type) { - $bundles = entity_get_bundles($entity_type); + $bundles = entity_get_bundles($entity_type_id); $bundle_options = array(); foreach ($bundles as $bundle_id => $bundle_info) { $bundle_options[$bundle_id] = $bundle_info['label']; } - $bundles_title = $entity_info->getBundleLabel() ?: $this->t('Bundles'); - if ($entity_info->isSubclassOf('Drupal\Core\Entity\ContentEntityInterface')) { - $fields = $this->entityManager->getFieldDefinitions($entity_type); + $bundles_title = $entity_type->getBundleLabel() ?: $this->t('Bundles'); + if ($entity_type->isSubclassOf('Drupal\Core\Entity\ContentEntityInterface')) { + $fields = $this->entityManager->getFieldDefinitions($entity_type_id); } $bundle_name = (empty($fields) || empty($fields[$bundle_type]['label'])) ? t('bundles') : $fields[$bundle_type]['label']; $form['bundles'] = array( @@ -117,7 +117,7 @@ public function buildOptionsForm(&$form, &$form_state) { // Offer the option to filter by access to the entity in the argument. $form['access'] = array( '#type' => 'checkbox', - '#title' => t('Validate user has access to the %name', array('%name' => $entity_info->getLabel())), + '#title' => t('Validate user has access to the %name', array('%name' => $entity_type->getLabel())), '#default_value' => $this->options['access'], ); $form['operation'] = array( @@ -138,8 +138,8 @@ public function buildOptionsForm(&$form, &$form_state) { '#type' => 'radios', '#title' => t('Multiple arguments'), '#options' => array( - 0 => t('Single ID', array('%type' => $entity_info->getLabel())), - 1 => t('One or more IDs separated by , or +', array('%type' => $entity_info->getLabel())), + 0 => t('Single ID', array('%type' => $entity_type->getLabel())), + 1 => t('One or more IDs separated by , or +', array('%type' => $entity_type->getLabel())), ), '#default_value' => (string) $this->options['multiple'], ); diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index e371f7df8dc4cd094227f5c9b997e4f63da8a1fc..afff44314e66fc81e1ea2d2b659c71d704505796 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -1608,8 +1608,8 @@ public function buildOptionsForm(&$form, &$form_state) { $form['#title'] .= t('Field Language'); $translatable_entity_tables = array(); - foreach (\Drupal::entityManager()->getDefinitions() as $entity_info) { - if ($entity_info->isTranslatable() && $base_table = $entity_info->getBaseTable()) { + foreach (\Drupal::entityManager()->getDefinitions() as $entity_type) { + if ($entity_type->isTranslatable() && $base_table = $entity_type->getBaseTable()) { $translatable_entity_tables[] = $base_table; } } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php index 662282d8d80910f7e2d9d7d9f22af49ab200a458..3ebd71cf205ea824d3c82eac257d13e02c90506d 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php @@ -1255,9 +1255,9 @@ public function query($get_count = FALSE) { ); } - foreach ($entity_information as $entity_type => $info) { - $entity_info = \Drupal::entityManager()->getDefinition($entity_type); - $base_field = empty($table['revision']) ? $entity_info->getKey('id') : $entity_info->getKey('revision'); + foreach ($entity_information as $entity_type_id => $info) { + $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); + $base_field = empty($table['revision']) ? $entity_type->getKey('id') : $entity_type->getKey('revision'); $this->addField($info['alias'], $base_field, '', $params); } } @@ -1500,8 +1500,8 @@ public function getEntityTableInfo() { // Determine which of the tables are revision tables. foreach ($entity_tables as $table_alias => $table) { - $info = \Drupal::entityManager()->getDefinition($table['entity_type']); - if ($info->getRevisionTable() == $table['base']) { + $entity_type = \Drupal::entityManager()->getDefinition($table['entity_type']); + if ($entity_type->getRevisionTable() == $table['base']) { $entity_tables[$table_alias]['revision'] = TRUE; } } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php index 96e1a8fed083f77fc391f0f670b72e286ecc019a..e741f3a2dcf7a097198ad6996290491212d7e4d2 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php @@ -38,14 +38,14 @@ abstract class WizardPluginBase extends PluginBase implements WizardInterface { * * @var string */ - protected $entity_type; + protected $entityTypeId; /** * Contains the information from entity_get_info of the $entity_type. * * @var \Drupal\Core\Entity\EntityTypeInterface */ - protected $entity_info; + protected $entityType; /** * An array of validated view objects, keyed by a hash. @@ -118,11 +118,11 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi $this->base_table = $this->definition['base_table']; - $entities = \Drupal::entityManager()->getDefinitions(); - foreach ($entities as $entity_type => $entity_info) { - if ($this->base_table == $entity_info->getBaseTable()) { - $this->entity_info = $entity_info; - $this->entity_type = $entity_type; + $entity_types = \Drupal::entityManager()->getDefinitions(); + foreach ($entity_types as $entity_type_id => $entity_type) { + if ($this->base_table == $entity_type->getBaseTable()) { + $this->entityType = $entity_type; + $this->entityTypeId = $entity_type_id; } } } @@ -561,9 +561,9 @@ protected function rowStyleOptions() { protected function buildFilters(&$form, &$form_state) { module_load_include('inc', 'views_ui', 'admin'); - $bundles = entity_get_bundles($this->entity_type); + $bundles = entity_get_bundles($this->entityTypeId); // If the current base table support bundles and has more than one (like user). - if (!empty($bundles) && $this->entity_info) { + if (!empty($bundles) && $this->entityType) { // Get all bundles and their human readable names. $options = array('all' => t('All')); foreach ($bundles as $type => $bundle) { @@ -837,7 +837,7 @@ protected function defaultDisplayFiltersUser(array $form, array &$form_state) { $filters = array(); if (!empty($form_state['values']['show']['type']) && $form_state['values']['show']['type'] != 'all') { - $bundle_key = $this->entity_info->getKey('bundle'); + $bundle_key = $this->entityType->getKey('bundle'); // Figure out the table where $bundle_key lives. It may not be the same as // the base table for the view; the taxonomy vocabulary machine_name, for // example, is stored in taxonomy_vocabulary, not taxonomy_term_data. diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php index ef0a8c737c345be9d9fdf4693927789d19715030..ab4a6b53ed7b93ee79a4dc4317b3a6b8356bcd43 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php @@ -51,10 +51,10 @@ protected function setUp() { */ public function testEntityAreaData() { $data = $this->container->get('views.views_data')->get('views'); - $entity_info = $this->container->get('entity.manager')->getDefinitions(); + $entity_types = $this->container->get('entity.manager')->getDefinitions(); - $expected_entities = array_filter($entity_info, function (EntityTypeInterface $info) { - return $info->hasViewBuilderClass(); + $expected_entities = array_filter($entity_types, function (EntityTypeInterface $entity_type) { + return $entity_type->hasViewBuilderClass(); }); // Test that all expected entity types have data. @@ -64,8 +64,8 @@ public function testEntityAreaData() { $this->assertEqual($entity, $data['entity_' . $entity]['area']['entity_type'], format_string('Correct entity_type set for @entity', array('@entity' => $entity))); } - $expected_entities = array_filter($entity_info, function (EntityTypeInterface $info) { - return !$info->hasViewBuilderClass(); + $expected_entities = array_filter($entity_types, function (EntityTypeInterface $type) { + return !$type->hasViewBuilderClass(); }); // Test that no configuration entity types have data. diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php index 44955a52aef009ebfe6136770707d072c005ea8f..ba67b0ad37533f0829ff7fcffe7b92cdcf409a12 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php @@ -40,11 +40,11 @@ class ViewStorageTest extends ViewUnitTestBase { ); /** - * The configuration entity information from entity_get_info(). + * The entity type definition. * - * @var array + * @var \Drupal\Core\Entity\EntityTypeInterface */ - protected $info; + protected $entityType; /** * The configuration entity storage controller. @@ -72,12 +72,12 @@ public static function getInfo() { * Tests CRUD operations. */ function testConfigurationEntityCRUD() { - // Get the configuration entity information and controller. - $this->info = \Drupal::entityManager()->getDefinition('view'); + // Get the configuration entity type and controller. + $this->entityType = \Drupal::entityManager()->getDefinition('view'); $this->controller = $this->container->get('entity.manager')->getStorageController('view'); // Confirm that an info array has been returned. - $this->assertTrue($this->info instanceof EntityTypeInterface, 'The View info array is loaded.'); + $this->assertTrue($this->entityType instanceof EntityTypeInterface, 'The View info array is loaded.'); // Confirm we have the correct controller class. $this->assertTrue($this->controller instanceof ViewStorageController, 'The correct controller is loaded.'); diff --git a/core/modules/views/views.views.inc b/core/modules/views/views.views.inc index 66e30fd6b36e10a42382f0ae6f29f5b20f2165f9..d11c4d7553dc712d97f95abf7862885d35b8b7da 100644 --- a/core/modules/views/views.views.inc +++ b/core/modules/views/views.views.inc @@ -115,15 +115,15 @@ function views_views_data() { ); // Registers an entity area handler per entity type. - foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $entity_info) { + foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) { // Exclude entity types, which cannot be rendered. - if ($entity_info->hasViewBuilderClass()) { - $label = $entity_info->getLabel(); - $data['views']['entity_' . $entity_type] = array( + if ($entity_type->hasViewBuilderClass()) { + $label = $entity_type->getLabel(); + $data['views']['entity_' . $entity_type_id] = array( 'title' => t('Rendered entity - @label', array('@label' => $label)), 'help' => t('Displays a rendered @label entity in an area.', array('@label' => $label)), 'area' => array( - 'entity_type' => $entity_type, + 'entity_type' => $entity_type_id, 'id' => 'entity', ), ); diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php index 62ffce81b6013e0af794e3cfd22d8f542503fff3..9ff3d79ee21451c8746053b025b6497cfab80e45 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php @@ -31,10 +31,10 @@ class ViewListController extends ConfigEntityListController implements EntityCon /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( - $entity_info, - $container->get('entity.manager')->getStorageController($entity_info->id()), + $entity_type, + $container->get('entity.manager')->getStorageController($entity_type->id()), $container->get('plugin.manager.views.display') ); } @@ -42,15 +42,15 @@ public static function createInstance(ContainerInterface $container, EntityTypeI /** * Constructs a new EntityListController object. * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info - * An array of entity info for this entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage. * The entity storage controller class. * @param \Drupal\Component\Plugin\PluginManagerInterface $display_manager * The views display plugin manager to use. */ - public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, PluginManagerInterface $display_manager) { - parent::__construct($entity_info, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageControllerInterface $storage, PluginManagerInterface $display_manager) { + parent::__construct($entity_type, $storage); $this->displayManager = $display_manager; } diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php index 4da13aaad435bff5b9b903dafa8f655c75cfb50c..96d59702c42c6920362e92f97b534646aeb76c27 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php @@ -851,7 +851,7 @@ public function __construct($color) { /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static('yellow'); }