diff --git a/core/includes/entity.api.php b/core/includes/entity.api.php index a56c1ef..3f39e75 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 77ec01a..c2c97c4 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 f3c02ed..0487d03 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. @@ -68,20 +92,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. * * @var string @@ -115,43 +125,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. * * @todo This is only used by \Drupal\Core\Entity\DatabaseStorageController. diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 6adeb96..2d2d0b2 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -91,7 +91,7 @@ public function processDefinition(&$definition, $plugin_id) { */ public function hasController($entity_type, $controller_type) { $definition = $this->getDefinition($entity_type); - return !empty($definition[$controller_type]); + return !empty($definition['controllers'][$controller_type]); } /** @@ -110,6 +110,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)); } @@ -143,7 +144,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]; @@ -160,7 +161,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]; @@ -179,7 +180,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]; @@ -196,7 +197,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]; @@ -213,7 +214,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 4ac5d9a..377a002 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 318c741..8298a41 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 f3fc06c..d7a410d 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 933b890..63f5e82 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 dca5964..3103120 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 2d8c638..e720226 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 57e4b61..545f832 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 1b25224..8967081 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 e8af942..b57c74f 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 823840b..b62538e 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 ba2e8a7..2983a44 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 a8afe02..a122204 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 f6afcfe..afb3ff0 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 ed67a45..4bc9dbc 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 a1c2329..99ffd93 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 757094d..af01eb4 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 14d02e8..b45bde0 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 363d54f..2f1c433 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 6f6f03e..7f524d6 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 1b39900..7875bc4 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 79e82ff..976690a 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 16f5921..112ba6c 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 9a99208..6e10b39 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 1a0d531..202c0fe 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 957c009..0678407 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 c4c199a..adaf260 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 cb13887..d2f4880 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 d13655e..ece3aac 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 85cca64..305fc33 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 c4d8109..99c6b88 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 2c30145..64e57fb 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 7d28544..57b75df 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 cfb5b7a..b014331 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 6135bf0..cb0ea4d 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 b56b24f..b7559b9 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 9026ea6..0a43318 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 9db76eb..bf9a10d 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 7ca3c68..c6b025d 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 43f0605..970f5e7 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 469bcb6..393b110 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 4448d17..887e3d4 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 342de3e..bef2148 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 bb13b06..6b10152 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 64bcb6f..14b8cd0 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 0632e2a..7d01d57 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 07f2a81..60811db 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 c9ede6a..c69171d 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 1f83011..c53ff76 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 aee3c67..dbac33b 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 cb75cb2..e4dca3e 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 ed75a43..662d365 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 5b167f4..829babc 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 8fface7..b8ca3bc 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 9cf0134..465ae17 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 f2178ab..99d23c1 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)),