diff --git a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php index 59b687e..ea429b2 100644 --- a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php +++ b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php @@ -6,6 +6,8 @@ */ namespace Drupal\Core\Entity\Annotation; + +use Drupal\Component\Annotation\AnnotationInterface; use Drupal\Component\Utility\NestedArray; /** @@ -14,13 +16,10 @@ class EntityType { public function __construct($values) { - $reflection = new \ReflectionClass($this); // Only keep actual default values by ignoring NULL values. - $parsed_values = $this->parse(array_filter($values, function ($value) { + $this->definition = $this->parse(array_filter($values, function ($value) { return $value !== NULL; })); - - $this->definition = $parsed_values; } /** @@ -53,4 +52,5 @@ protected function parse(array $values) { public function get() { return $this->definition; } + } diff --git a/core/lib/Drupal/Core/Entity/EntityListController.php b/core/lib/Drupal/Core/Entity/EntityListController.php index b11c5ba..c82c3bf 100644 --- a/core/lib/Drupal/Core/Entity/EntityListController.php +++ b/core/lib/Drupal/Core/Entity/EntityListController.php @@ -62,14 +62,14 @@ public static function createInstance(ContainerInterface $container, $entity_typ * * @param string $entity_type * The type of entity to be listed. - * @param array $entity_info + * @param \Drupal\Core\Entity\EntityType $entity_info * An array of entity info for the entity type. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The entity storage controller class. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke hooks on. */ - public function __construct($entity_type, array $entity_info, EntityStorageControllerInterface $storage, ModuleHandlerInterface $module_handler) { + public function __construct($entity_type, EntityType $entity_info, EntityStorageControllerInterface $storage, ModuleHandlerInterface $module_handler) { $this->entityType = $entity_type; $this->storage = $storage; $this->entityInfo = $entity_info; diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php index 59c269c..bd395f2 100644 --- a/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -70,6 +70,9 @@ class EntityType { * @var array */ public $controllers = array( + 'form' => array(), + 'list' => NULL, + 'render' => NULL, 'access' => 'Drupal\Core\Entity\EntityAccessController', ); @@ -433,10 +436,13 @@ public function getRevisionTable() { * @todo Interfaces from outside \Drupal\Core or \Drupal\Component should not * be used here. * - * @var array + * @return array */ public function getControllers() { return $this->controllers + array( + 'form' => array(), + 'list' => '', + 'render' => '', 'access' => 'Drupal\Core\Entity\EntityAccessController', ); } @@ -480,24 +486,16 @@ public function fieldsCacheable() { /** * The human-readable name of the type. - * - * @ingroup plugin_translatable - * - * @var \Drupal\Core\Annotation\Translation */ public function getLabel() { - return $this->label->get(); + return $this->label; } /** * The human-readable name of the entity bundles, e.g. Vocabulary. - * - * @ingroup plugin_translatable - * - * @var \Drupal\Core\Annotation\Translation */ public function getBundleLable() { - return $this->bundle_label->get(); + return $this->bundle_label; } /** diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Access/TaxonomyTermCreateAccess.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Access/TaxonomyTermCreateAccess.php index dbf7d06..a562b17 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Access/TaxonomyTermCreateAccess.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Access/TaxonomyTermCreateAccess.php @@ -8,6 +8,7 @@ namespace Drupal\taxonomy\Access; use Drupal\Core\Entity\EntityCreateAccessCheck; +use Drupal\Core\Entity\EntityType; use Symfony\Component\HttpFoundation\Request; /** @@ -23,7 +24,7 @@ class TaxonomyTermCreateAccess extends EntityCreateAccessCheck { /** * {@inheritdoc} */ - protected function prepareEntityValues(array $definition, Request $request, $bundle = NULL) { + protected function prepareEntityValues(EntityType $definition, Request $request, $bundle = NULL) { $values = array(); if ($vocabulary = $request->attributes->get('taxonomy_vocabulary')) { $values = parent::prepareEntityValues($definition, $request, $vocabulary->id()); 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 0ebc248..cf2f55d 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php @@ -49,14 +49,14 @@ public static function createInstance(ContainerInterface $container, $entity_typ * The type of entity to be listed. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage. * The entity storage controller class. - * @param array $entity_info + * @param \Drupal\Core\Entity\EntityType $entity_info * An array of entity info for this entity type. * @param \Drupal\Component\Plugin\PluginManagerInterface $display_manager * The views display plugin manager to use. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. */ - public function __construct($entity_type, EntityStorageControllerInterface $storage, $entity_info, PluginManagerInterface $display_manager, ModuleHandlerInterface $module_handler) { + public function __construct($entity_type, EntityStorageControllerInterface $storage, EntityType $entity_info, PluginManagerInterface $display_manager, ModuleHandlerInterface $module_handler) { parent::__construct($entity_type, $entity_info, $storage, $module_handler); $this->displayManager = $display_manager;