diff --git a/core/includes/entity.api.php b/core/includes/entity.api.php index a56c1ef0af2cc128384fc1ff466fe5915c1df254..3f39e75cc9cd60e9f4bf086f1acb0b9b307d2c71 100644 --- a/core/includes/entity.api.php +++ b/core/includes/entity.api.php @@ -26,8 +26,8 @@ function hook_entity_info(&$entity_info) { // Add a form controller for a custom node form without overriding the default // node form. To override the default node form, use hook_entity_info_alter() - // to alter $entity_info['node']['form_controller_class']['default']. - $entity_info['node']['form_controller_class']['mymodule_foo'] = 'Drupal\mymodule\NodeFooFormController'; + // to alter $entity_info['node']['controllers']['form']['default']. + $entity_info['node']['controllers']['form']['mymodule_foo'] = 'Drupal\mymodule\NodeFooFormController'; } /** @@ -216,7 +216,7 @@ function hook_entity_bundle_delete($entity_type, $bundle) { function hook_entity_info_alter(&$entity_info) { // Set the controller class for nodes to an alternate implementation of the // Drupal\Core\Entity\EntityStorageControllerInterface interface. - $entity_info['node']['controller_class'] = 'Drupal\mymodule\MyCustomNodeStorageController'; + $entity_info['node']['controllers']['storage'] = 'Drupal\mymodule\MyCustomNodeStorageController'; } /** diff --git a/core/includes/entity.inc b/core/includes/entity.inc index 77ec01ad52d9c87fee8653c3aa991f7c64581f5d..c2c97c4529f314c6f26e740049de8db8c4e39182 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -250,8 +250,8 @@ function entity_load_by_uuid($entity_type, $uuid, $reset = FALSE) { * Drupal\Core\Entity\EntityStorageControllerInterface interface. By default, * Drupal\Core\Entity\DatabaseStorageController is used. Entity types can * specify that a different class should be used by setting the - * 'controller_class' key in the entity plugin annotation. These classes can - * either implement the Drupal\Core\Entity\EntityStorageControllerInterface + * "controllers['storage']" key in the entity plugin annotation. These classes + * can either implement the Drupal\Core\Entity\EntityStorageControllerInterface * interface, or, most commonly, extend the * Drupal\Core\Entity\DatabaseStorageController class. * See Drupal\node\Plugin\Core\Entity\Node and Drupal\node\NodeStorageController diff --git a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php index f3c02ed12ae33a44509f9a8af989d687ea3cccfe..0487d0378d5678419e1f452fb0e260653aa9a360 100644 --- a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php +++ b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php @@ -42,13 +42,37 @@ class EntityType extends Plugin { public $base_table; /** - * The name of the class that is used to load the objects. + * An associative array where the keys are the names of different controller + * types (listed below) and the values are the names of the classes that + * implement that controller: + * - storage: The name of the class that is used to load the objects. The + * class must implement \Drupal\Core\Entity\EntityStorageControllerInterface. + * - form: An associative array where the keys are the names of the different + * form operations (such as 'create', 'edit', or 'delete') and the values + * are the names of the controller classes for those operations. The name of + * the operation is passed also to the form controller's constructor, so + * that one class can be used for multiple entity forms when the forms are + * similar. The classes must implement + * \Drupal\Core\Entity\EntityFormControllerInterface + * - list: The name of the class that provides listings of the entities. The + * class must implement \Drupal\Core\Entity\EntityListControllerInterface. + * - render: The name of the class that is used to render the entities. The + * class must implement \Drupal\Core\Entity\EntityRenderControllerInterface. + * - access: The name of the class that is used for access checks. The class + * must implement \Drupal\Core\Entity\EntityAccessControllerInterface. + * Defaults to \Drupal\Core\Entity\EntityAccessController. + * - translation: The name of the controller class that should be used to + * handle the translation process. The class must implement + * \Drupal\translation_entity\EntityTranslationControllerInterface. * - * This must implement \Drupal\Core\Entity\EntityStorageControllerInterface. + * @todo Interfaces from outside \Drupal\Core or \Drupal\Component should not + * be used here. * - * @var string + * @var array */ - public $controller_class = 'Drupal\Core\Entity\DatabaseStorageController'; + public $controllers = array( + 'access' => 'Drupal\Core\Entity\EntityAccessController', + ); /** * Boolean indicating whether fields can be attached to entities of this type. @@ -67,20 +91,6 @@ class EntityType extends Plugin { */ public $field_cache = TRUE; - /** - * The names of classes for various form operations. - * - * An associative array where the keys are the names of the different form - * operations (such as 'create', 'edit', or 'delete') and the values are the - * names of the controller classes for those operations. The name of the - * operation is passed also to the form controller's constructor, so that one - * class can be used for multiple entity forms when the forms are similar. - * Defaults to Drupal\Core\Entity\EntityFormController. - * - * @var array (optional) - */ - public $form_controller_class = array('Drupal\Core\Entity\EntityFormController'); - /** * The human-readable name of the type. * @@ -114,43 +124,6 @@ class EntityType extends Plugin { */ public $label_callback; - /** - * The name of the class that provides listings of the entities. - * - * The class must implement \Drupal\Core\Entity\EntityListControllerInterface. - * - * @var string - */ - public $list_controller_class = 'Drupal\Core\Entity\EntityListController'; - - /** - * The name of the class that is used to render the entities. - * - * @var string - */ - public $render_controller_class; - - /** - * The name of the class that is used for access checks. - * - * The class must implement \Drupal\Core\Entity\EntityAccessControllerInterface. - * - * @var string - */ - public $access_controller_class = 'Drupal\Core\Entity\EntityAccessController'; - - /** - * The name of the translation controller class that should be used to handle the translation process. - * - * The class must implement \Drupal\translation_entity\EntityTranslationControllerInterface. - * - * @todo Interfaces from outside \Drupal\Core or \Drupal\Component should not - * be used here. - * - * @var string - */ - public $translation_controller_class; - /** * Boolean indicating whether entities should be statically cached during a page request. * diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index ef7450f8f95ec1bc72e02d1de7cbcf9baecd3471..c5d72f2034fd4e5651732f3af0be2396bb87b021 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -70,7 +70,7 @@ public function __construct(array $namespaces) { */ public function hasController($entity_type, $controller_type) { $definition = $this->getDefinition($entity_type); - return !empty($definition[$controller_type]); + return !empty($definition['controllers'][$controller_type]); } /** @@ -89,6 +89,7 @@ public function hasController($entity_type, $controller_type) { */ public function getControllerClass($entity_type, $controller_type, $nested = NULL) { $definition = $this->getDefinition($entity_type); + $definition = $definition['controllers']; if (empty($definition[$controller_type])) { throw new \InvalidArgumentException(sprintf('The entity (%s) did not specify a %s.', $entity_type, $controller_type)); } @@ -122,7 +123,7 @@ public function getControllerClass($entity_type, $controller_type, $nested = NUL */ public function getStorageController($entity_type) { if (!isset($this->controllers['storage'][$entity_type])) { - $class = $this->getControllerClass($entity_type, 'controller_class'); + $class = $this->getControllerClass($entity_type, 'storage'); $this->controllers['storage'][$entity_type] = new $class($entity_type); } return $this->controllers['storage'][$entity_type]; @@ -139,7 +140,7 @@ public function getStorageController($entity_type) { */ public function getListController($entity_type) { if (!isset($this->controllers['listing'][$entity_type])) { - $class = $this->getControllerClass($entity_type, 'list_controller_class'); + $class = $this->getControllerClass($entity_type, 'list'); $this->controllers['listing'][$entity_type] = new $class($entity_type, $this->getStorageController($entity_type)); } return $this->controllers['listing'][$entity_type]; @@ -158,7 +159,7 @@ public function getListController($entity_type) { */ public function getFormController($entity_type, $operation) { if (!isset($this->controllers['form'][$operation][$entity_type])) { - $class = $this->getControllerClass($entity_type, 'form_controller_class', $operation); + $class = $this->getControllerClass($entity_type, 'form', $operation); $this->controllers['form'][$operation][$entity_type] = new $class($operation); } return $this->controllers['form'][$operation][$entity_type]; @@ -175,7 +176,7 @@ public function getFormController($entity_type, $operation) { */ public function getRenderController($entity_type) { if (!isset($this->controllers['render'][$entity_type])) { - $class = $this->getControllerClass($entity_type, 'render_controller_class'); + $class = $this->getControllerClass($entity_type, 'render'); $this->controllers['render'][$entity_type] = new $class($entity_type); } return $this->controllers['render'][$entity_type]; @@ -192,7 +193,7 @@ public function getRenderController($entity_type) { */ public function getAccessController($entity_type) { if (!isset($this->controllers['access'][$entity_type])) { - $class = $this->getControllerClass($entity_type, 'access_controller_class'); + $class = $this->getControllerClass($entity_type, 'access'); $this->controllers['access'][$entity_type] = new $class($entity_type); } return $this->controllers['access'][$entity_type]; diff --git a/core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php index 4ac5d9a19984aaf3403096bdf3d24bdb60a53f3b..377a002444034a3610835ea1e038d1494c01a511 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php @@ -10,7 +10,7 @@ /** * Defines a common interface for entity controller classes. * - * All entity controller classes specified via the 'controller_class' key + * All entity controller classes specified via the "controllers['storage']" key * returned by \Drupal\Core\Entity\EntityManager or hook_entity_info_alter() * have to implement this interface. * diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Core/Entity/Feed.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Core/Entity/Feed.php index 318c7412041c6b7556c893785f95ce444607ccc9..8298a416e7325c1392ba3130dd4ae3c356152359 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Core/Entity/Feed.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Core/Entity/Feed.php @@ -19,10 +19,12 @@ * id = "aggregator_feed", * label = @Translation("Aggregator feed"), * module = "aggregator", - * controller_class = "Drupal\aggregator\FeedStorageController", - * render_controller_class = "Drupal\aggregator\FeedRenderController", - * form_controller_class = { - * "default" = "Drupal\aggregator\FeedFormController" + * controllers = { + * "storage" = "Drupal\aggregator\FeedStorageController", + * "render" = "Drupal\aggregator\FeedRenderController", + * "form" = { + * "default" = "Drupal\aggregator\FeedFormController" + * } * }, * base_table = "aggregator_feed", * fieldable = TRUE, diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Core/Entity/Item.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Core/Entity/Item.php index f3fc06c54cc759181308f6d599d3f6154f1cdc8b..d7a410d26f8009a4a08debb4840c57ff283b5b6a 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Core/Entity/Item.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Core/Entity/Item.php @@ -19,8 +19,10 @@ * id = "aggregator_item", * label = @Translation("Aggregator feed item"), * module = "aggregator", - * controller_class = "Drupal\aggregator\ItemStorageController", - * render_controller_class = "Drupal\aggregator\ItemRenderController", + * controllers = { + * "storage" = "Drupal\aggregator\ItemStorageController", + * "render" = "Drupal\aggregator\ItemRenderController" + * }, * base_table = "aggregator_item", * fieldable = TRUE, * entity_keys = { diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Core/Entity/CustomBlock.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Core/Entity/CustomBlock.php index 933b890af8933ed79ea0672076cebca1ec551358..63f5e825f76d2170251c860cb5cf9824cbe95cec 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Core/Entity/CustomBlock.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Core/Entity/CustomBlock.php @@ -20,13 +20,15 @@ * label = @Translation("Custom Block"), * bundle_label = @Translation("Custom Block type"), * module = "custom_block", - * controller_class = "Drupal\custom_block\CustomBlockStorageController", - * access_controller_class = "Drupal\custom_block\CustomBlockAccessController", - * render_controller_class = "Drupal\custom_block\CustomBlockRenderController", - * form_controller_class = { - * "default" = "Drupal\custom_block\CustomBlockFormController" + * controllers = { + * "storage" = "Drupal\custom_block\CustomBlockStorageController", + * "access" = "Drupal\custom_block\CustomBlockAccessController", + * "render" = "Drupal\custom_block\CustomBlockRenderController", + * "form" = { + * "default" = "Drupal\custom_block\CustomBlockFormController" + * }, + * "translation" = "Drupal\custom_block\CustomBlockTranslationController" * }, - * translation_controller_class = "Drupal\custom_block\CustomBlockTranslationController", * base_table = "custom_block", * revision_table = "custom_block_revision", * menu_base_path = "block/%custom_block", diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Core/Entity/CustomBlockType.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Core/Entity/CustomBlockType.php index dca5964650b01aafa56f7ebbf0bfb2a42b190cb9..3103120533e650dde94c385767a7875a00a9f71a 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Core/Entity/CustomBlockType.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Core/Entity/CustomBlockType.php @@ -18,10 +18,12 @@ * id = "custom_block_type", * label = @Translation("Custom block type"), * module = "custom_block", - * controller_class = "Drupal\custom_block\CustomBlockTypeStorageController", - * list_controller_class = "Drupal\custom_block\CustomBlockTypeListController", - * form_controller_class = { - * "default" = "Drupal\custom_block\CustomBlockTypeFormController" + * controllers = { + * "storage" = "Drupal\custom_block\CustomBlockTypeStorageController", + * "form" = { + * "default" = "Drupal\custom_block\CustomBlockTypeFormController" + * }, + * "list" = "Drupal\custom_block\CustomBlockTypeListController" * }, * config_prefix = "custom_block.type", * entity_keys = { diff --git a/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php b/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php index 2d8c638b9b9db5480714ef719209017eae48b468..e720226a204833a58c7fb8f95e28e080a0e23fab 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php +++ b/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php @@ -19,12 +19,14 @@ * id = "block", * label = @Translation("Block"), * module = "block", - * controller_class = "Drupal\block\BlockStorageController", - * access_controller_class = "Drupal\block\BlockAccessController", - * render_controller_class = "Drupal\block\BlockRenderController", - * list_controller_class = "Drupal\block\BlockListController", - * form_controller_class = { - * "default" = "Drupal\block\BlockFormController" + * controllers = { + * "storage" = "Drupal\block\BlockStorageController", + * "access" = "Drupal\block\BlockAccessController", + * "render" = "Drupal\block\BlockRenderController", + * "list" = "Drupal\block\BlockListController", + * "form" = { + * "default" = "Drupal\block\BlockFormController" + * } * }, * config_prefix = "block.block", * fieldable = FALSE, diff --git a/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/Breakpoint.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/Breakpoint.php index 57e4b616e95d706ec464136044b0f30af0a11e70..545f832e1bf4655f358ade74d1ab7fa27c6824aa 100644 --- a/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/Breakpoint.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/Breakpoint.php @@ -23,7 +23,9 @@ * id = "breakpoint", * label = @Translation("Breakpoint"), * module = "breakpoint", - * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", + * controllers = { + * "storage" = "Drupal\Core\Config\Entity\ConfigStorageController" + * }, * config_prefix = "breakpoint.breakpoint", * entity_keys = { * "id" = "id", diff --git a/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/BreakpointGroup.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/BreakpointGroup.php index 1b252240369e80e6f159e1a42a4f46673f66536b..8967081bd40800a3d51afb3af3b391ea4b38497b 100644 --- a/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/BreakpointGroup.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/BreakpointGroup.php @@ -20,7 +20,9 @@ * id = "breakpoint_group", * label = @Translation("Breakpoint group"), * module = "breakpoint", - * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", + * controllers = { + * "storage" = "Drupal\Core\Config\Entity\ConfigStorageController" + * }, * config_prefix = "breakpoint.breakpoint_group", * entity_keys = { * "id" = "id", diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php b/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php index e8af94264b820ffd8ed1686211d2d88ae3237b22..b57c74f58bb3649e9700593d57150f4739f245c1 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php @@ -20,13 +20,15 @@ * label = @Translation("Comment"), * bundle_label = @Translation("Content type"), * module = "comment", - * controller_class = "Drupal\comment\CommentStorageController", - * access_controller_class = "Drupal\comment\CommentAccessController", - * render_controller_class = "Drupal\comment\CommentRenderController", - * form_controller_class = { - * "default" = "Drupal\comment\CommentFormController" + * controllers = { + * "storage" = "Drupal\comment\CommentStorageController", + * "access" = "Drupal\comment\CommentAccessController", + * "render" = "Drupal\comment\CommentRenderController", + * "form" = { + * "default" = "Drupal\comment\CommentFormController" + * }, + * "translation" = "Drupal\comment\CommentTranslationController" * }, - * translation_controller_class = "Drupal\comment\CommentTranslationController", * base_table = "comment", * uri_callback = "comment_uri", * fieldable = TRUE, diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigQueryTest.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigQueryTest.php index 823840b24278a80036bdba4edffd1ff515c6dd18..b62538e26490e2f8fda0445761bc723130408229 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigQueryTest.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigQueryTest.php @@ -17,10 +17,12 @@ * id = "config_query_test", * label = @Translation("Test configuration for query"), * module = "config_test", - * controller_class = "Drupal\config_test\ConfigTestStorageController", - * list_controller_class = "Drupal\Core\Config\Entity\ConfigEntityListController", - * form_controller_class = { - * "default" = "Drupal\config_test\ConfigTestFormController" + * controllers = { + * "storage" = "Drupal\config_test\ConfigTestStorageController", + * "list" = "Drupal\Core\Config\Entity\ConfigEntityListController", + * "form" = { + * "default" = "Drupal\config_test\ConfigTestFormController" + * } * }, * uri_callback = "config_test_uri", * config_prefix = "config_query_test.dynamic", diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTest.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTest.php index ba2e8a7fc0c9e247a47137f2ac3e0b396b79b72d..2983a44eb9a0c36d41ad91d8854ce2ea07502d78 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTest.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTest.php @@ -18,10 +18,12 @@ * id = "config_test", * label = @Translation("Test configuration"), * module = "config_test", - * controller_class = "Drupal\config_test\ConfigTestStorageController", - * list_controller_class = "Drupal\Core\Config\Entity\ConfigEntityListController", - * form_controller_class = { - * "default" = "Drupal\config_test\ConfigTestFormController" + * controllers = { + * "storage" = "Drupal\config_test\ConfigTestStorageController", + * "list" = "Drupal\Core\Config\Entity\ConfigEntityListController", + * "form" = { + * "default" = "Drupal\config_test\ConfigTestFormController" + * } * }, * uri_callback = "config_test_uri", * config_prefix = "config_test.dynamic", diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTestEmptyManifest.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTestEmptyManifest.php index a8afe02dda313aa4bbe1821718db4d8a6c03cc3b..a122204c7cbe5dc35e4c97743f863cf0a5b071f7 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTestEmptyManifest.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTestEmptyManifest.php @@ -18,7 +18,9 @@ * id = "config_test_empty_manifest", * label = @Translation("Test empty manifest creation"), * module = "config_test", - * controller_class = "Drupal\config_test\ConfigTestStorageController", + * controllers = { + * "storage" = "Drupal\config_test\ConfigTestStorageController" + * }, * config_prefix = "config_test.empty_manifest", * entity_keys = { * "id" = "id", diff --git a/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Category.php b/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Category.php index f6afcfe0544277676bfef8bdc18e03d0145b2d16..afb3ff062c7ccd450ec90fa6cb150d68fce1c095 100644 --- a/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Category.php +++ b/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Category.php @@ -18,10 +18,12 @@ * id = "contact_category", * label = @Translation("Contact category"), * module = "contact", - * controller_class = "Drupal\contact\CategoryStorageController", - * list_controller_class = "Drupal\contact\CategoryListController", - * form_controller_class = { - * "default" = "Drupal\contact\CategoryFormController" + * controllers = { + * "storage" = "Drupal\contact\CategoryStorageController", + * "list" = "Drupal\contact\CategoryListController", + * "form" = { + * "default" = "Drupal\contact\CategoryFormController" + * } * }, * uri_callback = "contact_category_uri", * config_prefix = "contact.category", diff --git a/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Message.php b/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Message.php index ed67a456ba19340dc6cc7b14d27ff6126f8996de..4bc9dbceaa3f3d4e0bd216a64cc3bb0b4353530f 100644 --- a/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Message.php +++ b/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Message.php @@ -18,10 +18,13 @@ * id = "contact_message", * label = @Translation("Contact message"), * module = "contact", - * form_controller_class = { - * "default" = "Drupal\contact\MessageFormController" + * controllers = { + * "storage" = "Drupal\Core\Entity\DatabaseStorageController", + * "render" = "Drupal\contact\MessageRenderController", + * "form" = { + * "default" = "Drupal\contact\MessageFormController" + * } * }, - * render_controller_class = "Drupal\contact\MessageRenderController", * entity_keys = { * "bundle" = "category" * }, diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php b/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php index a1c23292ad63a3b7e86970a6a96c30747b1c2204..99ffd93ce7b44d433d1a6c9e5bc9e785ab115910 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php @@ -18,7 +18,9 @@ * id = "editor", * label = @Translation("Editor"), * module = "editor", - * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", + * controllers = { + * "storage" = "Drupal\Core\Config\Entity\ConfigStorageController" + * }, * config_prefix = "editor.editor", * entity_keys = { * "id" = "format", diff --git a/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityDisplay.php b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityDisplay.php index 757094db2c38b0d0587bca151eac84cae49ca8ab..af01eb4341540227ba8206e2a851b22725912584 100644 --- a/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityDisplay.php +++ b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityDisplay.php @@ -19,7 +19,9 @@ * id = "entity_display", * label = @Translation("Entity display"), * module = "entity", - * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", + * controllers = { + * "storage" = "Drupal\Core\Config\Entity\ConfigStorageController" + * }, * config_prefix = "entity.display", * entity_keys = { * "id" = "id", diff --git a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php index b89953351649297ebcc9bee2ad0e6ad178096fb1..b6afefdd502ed40c75410a887bc185ab3794700e 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php @@ -22,7 +22,9 @@ * id = "field_entity", * label = @Translation("Field"), * module = "field", - * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", + * controllers = { + * "storage" = "Drupal\Core\Config\Entity\ConfigStorageController" + * }, * config_prefix = "field.field", * entity_keys = { * "id" = "id", diff --git a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php index 363d54f2c66d8e02e669b0dde742003b622ce7ca..2f1c433a62aef6f7d1e690d4903b88d5ffe33d9c 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php @@ -19,7 +19,9 @@ * id = "field_instance", * label = @Translation("Field instance"), * module = "field", - * controller_class = "Drupal\field\FieldInstanceStorageController", + * controllers = { + * "storage" = "Drupal\field\FieldInstanceStorageController" + * }, * config_prefix = "field.instance", * entity_keys = { * "id" = "id", diff --git a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/BundleKeyTestEntity.php b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/BundleKeyTestEntity.php index 6f6f03e465c50c94992bbd7453d4a3c7fb15ea90..7f524d664f09021261d9a9941bfbdb273a1849db 100644 --- a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/BundleKeyTestEntity.php +++ b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/BundleKeyTestEntity.php @@ -17,9 +17,11 @@ * id = "test_entity_bundle_key", * label = @Translation("Test Entity with a bundle key"), * module = "field_test", - * controller_class = "Drupal\field_test\TestEntityController", - * form_controller_class = { - * "default" = "Drupal\field_test\TestEntityFormController" + * controllers = { + * "storage" = "Drupal\field_test\TestEntityController", + * "form" = { + * "default" = "Drupal\field_test\TestEntityFormController" + * } * }, * field_cache = FALSE, * base_table = "test_entity_bundle_key", diff --git a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/BundleTestEntity.php b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/BundleTestEntity.php index 1b39900c34850fe51ceac5be2e8292f8c7d5e2c5..7875bc49d10d7d9851946ed25b2ab28b0176efd2 100644 --- a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/BundleTestEntity.php +++ b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/BundleTestEntity.php @@ -17,9 +17,11 @@ * id = "test_entity_bundle", * label = @Translation("Test Entity with a specified bundle"), * module = "field_test", - * controller_class = "Drupal\field_test\TestEntityController", - * form_controller_class = { - * "default" = "Drupal\field_test\TestEntityFormController" + * controllers = { + * "storage" = "Drupal\field_test\TestEntityController", + * "form" = { + * "default" = "Drupal\field_test\TestEntityFormController" + * } * }, * field_cache = FALSE, * base_table = "test_entity_bundle", diff --git a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/CacheableTestEntity.php b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/CacheableTestEntity.php index 79e82ffe648cac3edc28378c2c4773de5c1a9f20..976690ae981fd32be75ead5f059f3d88ac6a5fb9 100644 --- a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/CacheableTestEntity.php +++ b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/CacheableTestEntity.php @@ -17,7 +17,9 @@ * id = "test_cacheable_entity", * label = @Translation("Test Entity, cacheable"), * module = "field_test", - * controller_class = "Drupal\field_test\TestEntityController", + * controllers = { + * "storage" = "Drupal\field_test\TestEntityController" + * }, * field_cache = TRUE, * base_table = "test_entity", * revision_table = "test_entity_revision", diff --git a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/TestEntity.php b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/TestEntity.php index 16f59217c218d5751dd69f87511c2c38639c3696..112ba6cbf98c844078c6a2a53443999bf96d6377 100644 --- a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/TestEntity.php +++ b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/TestEntity.php @@ -18,10 +18,12 @@ * id = "test_entity", * label = @Translation("Test Entity"), * module = "field_test", - * controller_class = "Drupal\field_test\TestEntityController", - * render_controller_class = "Drupal\Core\Entity\EntityRenderController", - * form_controller_class = { - * "default" = "Drupal\field_test\TestEntityFormController" + * controllers = { + * "storage" = "Drupal\field_test\TestEntityController", + * "render" = "Drupal\Core\Entity\EntityRenderController", + * "form" = { + * "default" = "Drupal\field_test\TestEntityFormController" + * } * }, * field_cache = FALSE, * base_table = "test_entity", diff --git a/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php b/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php index 9a992084105bb76a1f6bd55dbdb83fc0477a0edb..6e10b398ad065f29a5af9891d5329df241781131 100644 --- a/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php +++ b/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php @@ -19,8 +19,10 @@ * id = "file", * label = @Translation("File"), * module = "file", - * controller_class = "Drupal\file\FileStorageController", - * render_controller_class = "Drupal\Core\Entity\EntityRenderController", + * controllers = { + * "storage" = "Drupal\file\FileStorageController", + * "render" = "Drupal\Core\Entity\EntityRenderController" + * }, * base_table = "file_managed", * entity_keys = { * "id" = "fid", diff --git a/core/modules/filter/lib/Drupal/filter/Plugin/Core/Entity/FilterFormat.php b/core/modules/filter/lib/Drupal/filter/Plugin/Core/Entity/FilterFormat.php index 1a0d5312336f4a05120f9cde8200cdd3ccceab76..202c0fe211bdb41a8601b03962236824b6d555e7 100644 --- a/core/modules/filter/lib/Drupal/filter/Plugin/Core/Entity/FilterFormat.php +++ b/core/modules/filter/lib/Drupal/filter/Plugin/Core/Entity/FilterFormat.php @@ -18,7 +18,9 @@ * id = "filter_format", * label = @Translation("Text format"), * module = "filter", - * controller_class = "Drupal\filter\FilterFormatStorageController", + * controllers = { + * "storage" = "Drupal\filter\FilterFormatStorageController" + * }, * config_prefix = "filter.format", * entity_keys = { * "id" = "format", diff --git a/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php index 957c0094116673b9e736c2a5d5411aca248583b7..0678407a0a285dc8c1d21d3bbc2da351e937e406 100644 --- a/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php +++ b/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php @@ -18,7 +18,9 @@ * id = "image_style", * label = @Translation("Image style"), * module = "image", - * controller_class = "Drupal\image\ImageStyleStorageController", + * controllers = { + * "storage" = "Drupal\image\ImageStyleStorageController" + * }, * uri_callback = "image_style_entity_uri", * config_prefix = "image.style", * entity_keys = { diff --git a/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php b/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php index c4c199a24fef24f0a928588fcc26b0d06ae07fab..adaf260faf0b99005f6e2e603966b85ba8565f1c 100644 --- a/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php +++ b/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php @@ -21,7 +21,9 @@ * id = "display", * label = @Translation("Display"), * module = "layout", - * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", + * controllers = { + * "storage" = "Drupal\Core\Config\Entity\ConfigStorageController" + * }, * config_prefix = "display.bound", * entity_keys = { * "id" = "id", diff --git a/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/UnboundDisplay.php b/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/UnboundDisplay.php index cb13887bba540c6b75030a6d6d33a1b1faee73db..d2f4880fdab74dbba9f533e0fcee06e99fe03453 100644 --- a/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/UnboundDisplay.php +++ b/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/UnboundDisplay.php @@ -24,7 +24,9 @@ * id = "unbound_display", * label = @Translation("Unbound Display"), * module = "layout", - * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", + * controllers = { + * "storage" = "Drupal\Core\Config\Entity\ConfigStorageController" + * }, * config_prefix = "display.unbound", * entity_keys = { * "id" = "id", diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index d13655e19f2eff1f0718c7ccdfede15d1df9dbb2..ece3aac6ec7aaee1d7bab57774ba7fefec1d32f7 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -146,9 +146,9 @@ function menu_menu() { * Implements hook_entity_info_alter(). */ function menu_entity_info_alter(&$entity_info) { - $entity_info['menu']['list_controller_class'] = 'Drupal\menu\MenuListController'; + $entity_info['menu']['controllers']['list'] = 'Drupal\menu\MenuListController'; $entity_info['menu']['uri_callback'] = 'menu_uri'; - $entity_info['menu']['form_controller_class'] = array( + $entity_info['menu']['controllers']['form'] = array( 'default' => 'Drupal\menu\MenuFormController', ); } diff --git a/core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php b/core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php index 85cca64a796b9e7d778f769e1961c1914129fba7..305fc3301d20306150448f7682f4e473f8854c12 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php @@ -21,10 +21,12 @@ * id = "menu_link", * label = @Translation("Menu link"), * module = "menu_link", - * controller_class = "Drupal\menu_link\MenuLinkStorageController", - * render_controller_class = "Drupal\Core\Entity\EntityRenderController", - * form_controller_class = { - * "default" = "Drupal\menu_link\MenuLinkFormController" + * controllers = { + * "storage" = "Drupal\menu_link\MenuLinkStorageController", + * "render" = "Drupal\Core\Entity\EntityRenderController", + * "form" = { + * "default" = "Drupal\menu_link\MenuLinkFormController" + * } * }, * static_cache = FALSE, * base_table = "menu_links", diff --git a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php index c4d810932e177fdf967664a4517c56f60be59e4f..99c6b8810a3b373831124ef3b4248546ec749b82 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php @@ -20,13 +20,15 @@ * label = @Translation("Content"), * bundle_label = @Translation("Content type"), * module = "node", - * controller_class = "Drupal\node\NodeStorageController", - * render_controller_class = "Drupal\node\NodeRenderController", - * access_controller_class = "Drupal\node\NodeAccessController", - * form_controller_class = { - * "default" = "Drupal\node\NodeFormController" + * controllers = { + * "storage" = "Drupal\node\NodeStorageController", + * "render" = "Drupal\node\NodeRenderController", + * "access" = "Drupal\node\NodeAccessController", + * "form" = { + * "default" = "Drupal\node\NodeFormController" + * }, + * "translation" = "Drupal\node\NodeTranslationController" * }, - * translation_controller_class = "Drupal\node\NodeTranslationController", * base_table = "node", * revision_table = "node_revision", * uri_callback = "node_uri", diff --git a/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php b/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php index 2c301451f6d491641eebc0dc85a656028090114c..64e57fbad029f8936935ffeaa1bbe1791c463742 100644 --- a/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php +++ b/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php @@ -18,13 +18,15 @@ * id = "picture_mapping", * label = @Translation("Picture mapping"), * module = "picture", - * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", - * form_controller_class = { - * "default" = "Drupal\picture\PictureMappingFormController", - * "add" = "Drupal\picture\PictureMappingFormController", - * "duplicate" = "Drupal\picture\PictureMappingFormController" + * controllers = { + * "storage" = "Drupal\Core\Config\Entity\ConfigStorageController", + * "list" = "Drupal\picture\PictureMappingListController", + * "form" = { + * "default" = "Drupal\picture\PictureMappingFormController", + * "add" = "Drupal\picture\PictureMappingFormController", + * "duplicate" = "Drupal\picture\PictureMappingFormController" + * } * }, - * list_controller_class = "Drupal\picture\PictureMappingListController", * list_path = "admin/config/media/picturemapping", * uri_callback = "picture_mapping_uri", * config_prefix = "picture.mappings", diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Core/Entity/Shortcut.php b/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Core/Entity/Shortcut.php index 7d28544ebf6437bc064d2fbac0bfade9ba2c8d76..57b75dfec408e851f93a9f9175d3cf156613eadb 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Core/Entity/Shortcut.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Core/Entity/Shortcut.php @@ -18,10 +18,12 @@ * id = "shortcut", * label = @Translation("Shortcut set"), * module = "shortcut", - * controller_class = "Drupal\shortcut\ShortcutStorageController", - * list_controller_class = "Drupal\shortcut\ShortcutListController", - * form_controller_class = { - * "default" = "Drupal\shortcut\ShortcutFormController" + * controllers = { + * "storage" = "Drupal\shortcut\ShortcutStorageController", + * "list" = "Drupal\shortcut\ShortcutListController", + * "form" = { + * "default" = "Drupal\shortcut\ShortcutFormController" + * } * }, * config_prefix = "shortcut.set", * entity_keys = { diff --git a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Menu.php b/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Menu.php index cfb5b7a9fbc2eaaf9764334d44466028ea836762..b0143312da8b1e7fbdfd5479d07e275fe4c1f479 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Menu.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Menu.php @@ -18,7 +18,9 @@ * id = "menu", * label = @Translation("Menu"), * module = "system", - * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", + * controllers = { + * "storage" = "Drupal\Core\Config\Entity\ConfigStorageController" + * }, * config_prefix = "menu.menu", * entity_keys = { * "id" = "id", 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 6135bf0a1d34eb43e67d3dfb5e110237ef8f24fb..cb0ea4dd46dea34f8bb2f57cdddaedf64962fd48 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php @@ -54,6 +54,6 @@ function testEntityInfoCacheWatchdog() { module_enable(array('entity_cache_test')); $info = state()->get('entity_cache_test'); $this->assertEqual($info['label'], 'Entity Cache Test', 'Entity info label is correct.'); - $this->assertEqual($info['controller_class'], 'Drupal\Core\Entity\DatabaseStorageController', 'Entity controller class info is correct.'); + $this->assertEqual($info['controllers']['storage'], 'Drupal\Core\Entity\DatabaseStorageController', 'Entity controller class info is correct.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityManagerTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityManagerTest.php index b56b24fde788dc55bc8a1c564fb47edc4612299b..b7559b919714e441392a86aa02c0a60dbd78f4e7 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityManagerTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityManagerTest.php @@ -29,13 +29,13 @@ public function testMethods() { // Tests the has controller method. $entity_manager = $this->container->get('plugin.manager.entity'); - $this->assertFalse($entity_manager->hasController('non_existent', 'controller_class'), 'A non existent entity type has no controller.'); - $this->assertFalse($entity_manager->hasController('non_existent', 'non_existent_controller_class'), 'A non existent entity type has no controller.'); + $this->assertFalse($entity_manager->hasController('non_existent', 'storage'), 'A non existent entity type has no controller.'); + $this->assertFalse($entity_manager->hasController('non_existent', 'non_existent'), 'A non existent entity type has no controller.'); - $this->assertFalse($entity_manager->hasController('entity_test', 'non_existent_controller_class'), 'An existent entity type does not have a non existent controller.'); - $this->assertFalse($entity_manager->hasController('entity_test', 'render_controller_class'), 'The test entity does not have specified the render controller.'); + $this->assertFalse($entity_manager->hasController('entity_test', 'non_existent'), 'An existent entity type does not have a non existent controller.'); + $this->assertFalse($entity_manager->hasController('entity_test', 'render'), 'The test entity does not have specified the render controller.'); - $this->assertTrue($entity_manager->hasController('entity_test', 'controller_class'), 'The test entity has specified the controller class'); + $this->assertTrue($entity_manager->hasController('entity_test', 'storage'), 'The test entity has specified the controller class'); } } diff --git a/core/modules/system/tests/modules/entity_cache_test_dependency/lib/Drupal/entity_cache_test_dependency/Plugin/Core/Entity/EntityCacheTest.php b/core/modules/system/tests/modules/entity_cache_test_dependency/lib/Drupal/entity_cache_test_dependency/Plugin/Core/Entity/EntityCacheTest.php index 9026ea6fb1fd462fcec4e33df43f530088671335..0a43318d9e792e52aa714354306129458188941e 100644 --- a/core/modules/system/tests/modules/entity_cache_test_dependency/lib/Drupal/entity_cache_test_dependency/Plugin/Core/Entity/EntityCacheTest.php +++ b/core/modules/system/tests/modules/entity_cache_test_dependency/lib/Drupal/entity_cache_test_dependency/Plugin/Core/Entity/EntityCacheTest.php @@ -17,6 +17,9 @@ * @EntityType( * id = "entity_cache_test", * label = @Translation("Entity cache test"), + * controllers = { + * "storage" = "Drupal\Core\Entity\DatabaseStorageController", + * }, * module = "entity_cache_test_dependency" * ) */ diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTest.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTest.php index 9db76eb110d2ec8e2ccb680be853b06572d87ced..bf9a10dde88818db52ca9e4942ed428ccf31fff9 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTest.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTest.php @@ -18,12 +18,14 @@ * id = "entity_test", * label = @Translation("Test entity"), * module = "entity_test", - * controller_class = "Drupal\entity_test\EntityTestStorageController", - * access_controller_class = "Drupal\entity_test\EntityTestAccessController", - * form_controller_class = { - * "default" = "Drupal\entity_test\EntityTestFormController" + * controllers = { + * "storage" = "Drupal\entity_test\EntityTestStorageController", + * "access" = "Drupal\entity_test\EntityTestAccessController", + * "form" = { + * "default" = "Drupal\entity_test\EntityTestFormController" + * }, + * "translation" = "Drupal\translation_entity\EntityTranslationControllerNG" * }, - * translation_controller_class = "Drupal\translation_entity\EntityTranslationControllerNG", * base_table = "entity_test", * fieldable = TRUE, * entity_keys = { diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestDefaultAccess.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestDefaultAccess.php index 7ca3c682211f3a1a544edf93529effb538991fdf..c6b025dc0bc6681f8b1fec801f477dd13c7672b3 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestDefaultAccess.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestDefaultAccess.php @@ -17,7 +17,9 @@ * id = "entity_test_default_access", * label = @Translation("Test entity with default access"), * module = "entity_test", - * controller_class = "Drupal\entity_test\EntityTestStorageController", + * controllers = { + * "storage" = "Drupal\entity_test\EntityTestStorageController" + * }, * base_table = "entity_test", * entity_keys = { * "id" = "id" diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestLabel.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestLabel.php index 43f0605f1b0f7a24a33b2c4129424877f85f9b0c..970f5e760e79ce622f0d1b56a2d2c058d6c2e835 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestLabel.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestLabel.php @@ -17,7 +17,9 @@ * id = "entity_test_label", * label = @Translation("Entity Test label"), * module = "entity_test", - * controller_class = "Drupal\entity_test\EntityTestStorageController", + * controllers = { + * "storage" = "Drupal\entity_test\EntityTestStorageController" + * }, * base_table = "entity_test", * entity_keys = { * "id" = "id", diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestLabelCallback.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestLabelCallback.php index 469bcb6c1fc99c154da1f1afdfc3ef26402dfcb1..393b1103d947294ead72ece029c163efb65448bd 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestLabelCallback.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestLabelCallback.php @@ -17,7 +17,9 @@ * id = "entity_test_label_callback", * label = @Translation("Entity test label callback"), * module = "entity_test", - * controller_class = "Drupal\entity_test\EntityTestStorageController", + * controllers = { + * "storage" = "Drupal\entity_test\EntityTestStorageController" + * }, * field_cache = FALSE, * base_table = "entity_test", * revision_table = "entity_test_revision", diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMul.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMul.php index 4448d1746ca90aede3c4d13f7de2bdff0c31e3de..887e3d4f18bdb54deda3fd90e00b69eaa6f1ab00 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMul.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMul.php @@ -18,12 +18,14 @@ * id = "entity_test_mul", * label = @Translation("Test entity - data table"), * module = "entity_test", - * controller_class = "Drupal\entity_test\EntityTestMulStorageController", - * access_controller_class = "Drupal\entity_test\EntityTestAccessController", - * form_controller_class = { - * "default" = "Drupal\entity_test\EntityTestFormController" + * controllers = { + * "storage" = "Drupal\entity_test\EntityTestMulStorageController", + * "access" = "Drupal\entity_test\EntityTestAccessController", + * "form" = { + * "default" = "Drupal\entity_test\EntityTestFormController" + * }, + * "translation" = "Drupal\translation_entity\EntityTranslationControllerNG" * }, - * translation_controller_class = "Drupal\translation_entity\EntityTranslationControllerNG", * base_table = "entity_test_mul", * data_table = "entity_test_mul_property_data", * fieldable = TRUE, diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMulRev.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMulRev.php index 342de3e2a400230af319d651fe0fe679327472f2..bef21482ee64cebbaf6a5ffb9dda01ab296035ec 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMulRev.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMulRev.php @@ -18,12 +18,14 @@ * id = "entity_test_mulrev", * label = @Translation("Test entity - revisions and data table"), * module = "entity_test", - * controller_class = "Drupal\entity_test\EntityTestMulRevStorageController", - * access_controller_class = "Drupal\entity_test\EntityTestAccessController", - * form_controller_class = { - * "default" = "Drupal\entity_test\EntityTestFormController" + * controllers = { + * "storage" = "Drupal\entity_test\EntityTestMulRevStorageController", + * "access" = "Drupal\entity_test\EntityTestAccessController", + * "form" = { + * "default" = "Drupal\entity_test\EntityTestFormController" + * }, + * "translation" = "Drupal\translation_entity\EntityTranslationControllerNG" * }, - * translation_controller_class = "Drupal\translation_entity\EntityTranslationControllerNG", * base_table = "entity_test_mulrev", * data_table = "entity_test_mulrev_property_data", * revision_table = "entity_test_mulrev_property_revision", diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestNoLabel.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestNoLabel.php index bb13b061c227436ef9201f1974c5f752c9fe46b2..6b101528fe03d6b48f3237b132d37ab972472ad7 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestNoLabel.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestNoLabel.php @@ -17,7 +17,9 @@ * id = "entity_test_no_label", * label = @Translation("Entity Test without label"), * module = "entity_test", - * controller_class = "Drupal\entity_test\EntityTestStorageController", + * controllers = { + * "storage" = "Drupal\entity_test\EntityTestStorageController" + * }, * field_cache = FALSE, * base_table = "entity_test", * entity_keys = { diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestRender.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestRender.php index 64bcb6fd6cbebc5826936c6726b60ff33943bdf8..14b8cd00948b321860c0ffdecc6d35e08fb93938 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestRender.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestRender.php @@ -17,8 +17,10 @@ * id = "entity_test_render", * label = @Translation("Test render entity"), * module = "entity_test", - * controller_class = "Drupal\entity_test\EntityTestStorageController", - * render_controller_class = "Drupal\entity_test\EntityTestRenderController", + * controllers = { + * "storage" = "Drupal\entity_test\EntityTestStorageController", + * "render" = "Drupal\entity_test\EntityTestRenderController" + * }, * base_table = "entity_test", * fieldable = TRUE, * entity_keys = { diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestRev.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestRev.php index 0632e2a103e61ec10e27724adc511db1983338c2..7d01d5796f6443da4bcf2a3b2c72a86b06f861fe 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestRev.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestRev.php @@ -18,12 +18,14 @@ * id = "entity_test_rev", * label = @Translation("Test entity - revisions"), * module = "entity_test", - * controller_class = "Drupal\entity_test\EntityTestRevStorageController", - * access_controller_class = "Drupal\entity_test\EntityTestAccessController", - * form_controller_class = { - * "default" = "Drupal\entity_test\EntityTestFormController" + * controllers = { + * "storage" = "Drupal\entity_test\EntityTestRevStorageController", + * "access" = "Drupal\entity_test\EntityTestAccessController", + * "form" = { + * "default" = "Drupal\entity_test\EntityTestFormController" + * }, + * "translation" = "Drupal\translation_entity\EntityTranslationControllerNG" * }, - * translation_controller_class = "Drupal\translation_entity\EntityTranslationControllerNG", * base_table = "entity_test_rev", * revision_table = "entity_test_rev_revision", * fieldable = TRUE, diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php index 07f2a81b016f674a6047352716fb42b79ce6d30f..60811dbfe2fd82f13727fb9f069729dd980d7346 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php @@ -20,13 +20,15 @@ * label = @Translation("Taxonomy term"), * bundle_label = @Translation("Vocabulary"), * module = "taxonomy", - * controller_class = "Drupal\taxonomy\TermStorageController", - * render_controller_class = "Drupal\taxonomy\TermRenderController", - * access_controller_class = "Drupal\taxonomy\TermAccessController", - * form_controller_class = { - * "default" = "Drupal\taxonomy\TermFormController" + * controllers = { + * "storage" = "Drupal\taxonomy\TermStorageController", + * "render" = "Drupal\taxonomy\TermRenderController", + * "access" = "Drupal\taxonomy\TermAccessController", + * "form" = { + * "default" = "Drupal\taxonomy\TermFormController" + * }, + * "translation" = "Drupal\taxonomy\TermTranslationController" * }, - * translation_controller_class = "Drupal\taxonomy\TermTranslationController", * base_table = "taxonomy_term_data", * uri_callback = "taxonomy_term_uri", * fieldable = TRUE, diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php index c9ede6ac09fe84a6768ccfced88b5ce6fd7e9563..c69171ddf9bc4d47c3107550b1d742c09c05bef9 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php @@ -18,10 +18,12 @@ * id = "taxonomy_vocabulary", * label = @Translation("Taxonomy vocabulary"), * module = "taxonomy", - * controller_class = "Drupal\taxonomy\VocabularyStorageController", - * access_controller_class = "Drupal\taxonomy\VocabularyAccessController", - * form_controller_class = { - * "default" = "Drupal\taxonomy\VocabularyFormController" + * controllers = { + * "storage" = "Drupal\taxonomy\VocabularyStorageController", + * "access" = "Drupal\taxonomy\VocabularyAccessController", + * "form" = { + * "default" = "Drupal\taxonomy\VocabularyFormController" + * } * }, * config_prefix = "taxonomy.vocabulary", * entity_keys = { diff --git a/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php b/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php index 1f83011ec4e8b88bddbc8958571f55a0af03c33b..c53ff765aa2a6fa6fdea6463c73a8fead3c1ba84 100644 --- a/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php +++ b/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php @@ -19,8 +19,10 @@ * id = "tour", * label = @Translation("Tour"), * module = "tour", - * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController", - * render_controller_class = "Drupal\tour\TourRenderController", + * controllers = { + * "storage" = "Drupal\Core\Config\Entity\ConfigStorageController", + * "render" = "Drupal\tour\TourRenderController" + * }, * config_prefix = "tour.tour", * entity_keys = { * "id" = "id", diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerInterface.php b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerInterface.php index aee3c676b36d8a1ede0bec22d5a1a31757b69c93..dbac33b52247fe5bcf29bcb710220798e8a9eab0 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerInterface.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerInterface.php @@ -36,7 +36,7 @@ * path wildcard' info key needs to be defined. * * Every entity type needs a translation controller to be translated. This can - * be specified through the 'translation_controller_class' key in the entity + * be specified through the "controllers['translation']" key in the entity * info. If an entity type is enabled for translation and no translation * controller is defined, Drupal\translation_entity\EntityTranslationController * will be assumed. Every translation controller class must implement @@ -63,7 +63,6 @@ * $info['myentity'] += array( * 'menu_base_path' => 'mymodule/myentity/%my_entity_loader', * 'menu_path_wildcard' => '%my_entity_loader', - * 'translation_controller_class' => 'Drupal\mymodule\MyEntityTranslationController', * 'translation' => array( * 'translation_entity' => array( * 'access_callback' => 'mymodule_myentity_translate_access', @@ -71,6 +70,7 @@ * ), * ), * ); + * $info['myentity']['controllers'] += array('translation' => 'Drupal\mymodule\MyEntityTranslationController'); * } * @endcode * diff --git a/core/modules/translation_entity/translation_entity.module b/core/modules/translation_entity/translation_entity.module index cb75cb2782488e9ac7a38e66a7d91893df6b7147..e4dca3e1b7656a325d59f83f0334955533df62a7 100644 --- a/core/modules/translation_entity/translation_entity.module +++ b/core/modules/translation_entity/translation_entity.module @@ -86,7 +86,7 @@ function translation_entity_entity_info_alter(array &$entity_info) { // matter if it is enabled for translation or not. As a matter of fact we // might need it to correctly switch field translatability when a field is // shared accross different entities. - $info += array('translation_controller_class' => 'Drupal\translation_entity\EntityTranslationController'); + $info['controllers'] += array('translation' => 'Drupal\translation_entity\EntityTranslationController'); // If no menu base path is provided we default to the usual // "entity_type/%entity_type" pattern. @@ -504,7 +504,7 @@ function translation_entity_types_translatable() { function translation_entity_controller($entity_type) { $entity_info = entity_get_info($entity_type); // @todo Throw an exception if the key is missing. - return new $entity_info['translation_controller_class']($entity_type, $entity_info); + return new $entity_info['controllers']['translation']($entity_type, $entity_info); } /** diff --git a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/Role.php b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/Role.php index ed75a430ebcef3d733314bd32d4674c628372fa9..662d36516688c442149ab464931c33e70992d39b 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/Role.php +++ b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/Role.php @@ -18,7 +18,9 @@ * id = "user_role", * label = @Translation("Role"), * module = "user", - * controller_class = "Drupal\user\RoleStorageController", + * controllers = { + * "storage" = "Drupal\user\RoleStorageController" + * }, * config_prefix = "user.role", * entity_keys = { * "id" = "id", diff --git a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php index 5b167f4c55ddde9f840c80b5814cedbc8a7c5f14..829babc0ca034004ce1c5be62df7ba2e83a3bae9 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php +++ b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php @@ -18,15 +18,17 @@ * id = "user", * label = @Translation("User"), * module = "user", - * controller_class = "Drupal\user\UserStorageController", - * render_controller_class = "Drupal\Core\Entity\EntityRenderController", - * access_controller_class = "Drupal\user\UserAccessController", - * form_controller_class = { - * "profile" = "Drupal\user\ProfileFormController", - * "register" = "Drupal\user\RegisterFormController" + * controllers = { + * "storage" = "Drupal\user\UserStorageController", + * "access" = "Drupal\user\UserAccessController", + * "render" = "Drupal\Core\Entity\EntityRenderController", + * "form" = { + * "profile" = "Drupal\user\ProfileFormController", + * "register" = "Drupal\user\RegisterFormController" + * }, + * "translation" = "Drupal\user\ProfileTranslationController" * }, * default_operation = "profile", - * translation_controller_class = "Drupal\user\ProfileTranslationController", * base_table = "users", * uri_callback = "user_uri", * label_callback = "user_label", diff --git a/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php b/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php index 8fface75e5182a4e9f1f05e8353cbedf41b4df17..b8ca3bc8380d8752631201be0d7bdd08d8e80367 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php +++ b/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php @@ -22,13 +22,15 @@ * id = "view", * label = @Translation("View"), * module = "views", - * controller_class = "Drupal\views\ViewStorageController", - * list_controller_class = "Drupal\views_ui\ViewListController", - * form_controller_class = { - * "edit" = "Drupal\views_ui\ViewEditFormController", - * "add" = "Drupal\views_ui\ViewAddFormController", - * "preview" = "Drupal\views_ui\ViewPreviewFormController", - * "clone" = "Drupal\views_ui\ViewCloneFormController" + * controllers = { + * "storage" = "Drupal\views\ViewStorageController", + * "list" = "Drupal\views_ui\ViewListController", + * "form" = { + * "edit" = "Drupal\views_ui\ViewEditFormController", + * "add" = "Drupal\views_ui\ViewAddFormController", + * "preview" = "Drupal\views_ui\ViewPreviewFormController", + * "clone" = "Drupal\views_ui\ViewCloneFormController" + * } * }, * config_prefix = "views.view", * fieldable = FALSE, 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 9cf013439351a43c06255628a5b769af57ba8c43..465ae1791436278029440b817160da9f9e85e63d 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php @@ -53,7 +53,7 @@ public function testEntityAreaData() { $entity_info = $this->container->get('plugin.manager.entity')->getDefinitions(); $expected_entities = array_filter($entity_info, function($info) { - return !empty($info['render_controller_class']); + return !empty($info['controllers']['render']); }); // Test that all expected entity types have data. @@ -64,7 +64,7 @@ public function testEntityAreaData() { } $expected_entities = array_filter($entity_info, function($info) { - return empty($info['render_controller_class']); + return empty($info['controllers']['render']); }); // Test that no configuration entity types have data. diff --git a/core/modules/views/views.views.inc b/core/modules/views/views.views.inc index f2178ab8b47634fbbb50f793e44b30fe391241c6..99d23c1d2ad8d5744a74dcb9cbeb5421f1c94a9e 100644 --- a/core/modules/views/views.views.inc +++ b/core/modules/views/views.views.inc @@ -109,7 +109,7 @@ function views_views_data() { // Registers an entity area handler per entity type. foreach (entity_get_info() as $entity_type => $entity_info) { // Exclude entity types, which cannot be rendered. - if (!empty($entity_info['render_controller_class'])) { + if (!empty($entity_info['controllers']['render'])) { $label = $entity_info['label']; $data['views']['entity_' . $entity_type] = array( 'title' => t('Rendered entity - @label', array('@label' => $label)),