diff --git a/core/includes/entity.inc b/core/includes/entity.inc index a686ec6..7da9668 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -236,7 +236,7 @@ function entity_load_by_uuid($entity_type, $uuid, $reset = FALSE) { * 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 + * See Drupal\node\Entity\Type\Node and Drupal\node\NodeStorageController * for an example. * * @param string $entity_type diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 739ccbc..a3a654d 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -166,7 +166,7 @@ class EntityManager extends PluginManagerBase { */ public function __construct() { // Allow the plugin definition to be altered by hook_entity_info_alter(). - $this->discovery = new AnnotatedClassDiscovery('Core', 'Entity'); + $this->discovery = new AnnotatedClassDiscovery('Core', 'Entity', NULL, 'Entity\Type'); $this->discovery = new InfoHookDecorator($this->discovery, 'entity_info'); $this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition')); $this->discovery = new AlterDecorator($this->discovery, 'entity_info'); diff --git a/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php index 0b387dc..7c412b4 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php @@ -17,10 +17,15 @@ class AnnotatedClassDiscovery extends ComponentAnnotatedClassDiscovery { /** * Constructs an AnnotatedClassDiscovery object. */ - function __construct($owner, $type, $root_namespaces = NULL) { + function __construct($owner, $type, $root_namespaces = NULL, $sub_namespace = NULL) { $this->owner = $owner; $this->type = $type; $this->rootNamespaces = $root_namespaces; + $default_subnamespace = "Plugin\\$owner\\$type"; + // @todo Change so that $sub_namespace overrides rather than adds to + // $default_subnamespace once all entity type plugins have been moved: + // http://drupal.org/node/1847002. + $this->subNamespaces = $sub_namespace ? array($sub_namespace, $default_subnamespace) : array($default_subnamespace); $annotation_namespaces = array( 'Drupal\Component\Annotation' => DRUPAL_ROOT . '/core/lib', 'Drupal\Core\Annotation' => DRUPAL_ROOT . '/core/lib', @@ -39,7 +44,9 @@ protected function getPluginNamespaces() { $plugin_namespaces = array(); $root_namespaces = isset($this->rootNamespaces) ? $this->rootNamespaces : drupal_classloader()->getNamespaces(); foreach ($root_namespaces as $namespace => $dirs) { - $plugin_namespaces["$namespace\\Plugin\\{$this->owner}\\{$this->type}"] = $dirs; + foreach ($this->subNamespaces as $sub_namespace) { + $plugin_namespaces["$namespace\\$sub_namespace"] = $dirs; + } } return $plugin_namespaces; } diff --git a/core/modules/book/book.admin.inc b/core/modules/book/book.admin.inc index d112180..60797b2 100644 --- a/core/modules/book/book.admin.inc +++ b/core/modules/book/book.admin.inc @@ -5,7 +5,7 @@ * Administration page callbacks for the Book module. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; /** * Page callback: Returns an administrative overview of all books. diff --git a/core/modules/book/book.module b/core/modules/book/book.module index 248759f..231ae57 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -5,7 +5,7 @@ * Allows users to create and organize related content in an outline. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\entity\Plugin\Core\Entity\EntityDisplay; use Drupal\Core\Template\Attribute; diff --git a/core/modules/book/book.pages.inc b/core/modules/book/book.pages.inc index f8ec0dc..15eac2a 100644 --- a/core/modules/book/book.pages.inc +++ b/core/modules/book/book.pages.inc @@ -5,7 +5,7 @@ * User page callbacks for the book module. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; diff --git a/core/modules/book/lib/Drupal/book/Tests/BookTest.php b/core/modules/book/lib/Drupal/book/Tests/BookTest.php index 0a1ffcf..2411d45 100644 --- a/core/modules/book/lib/Drupal/book/Tests/BookTest.php +++ b/core/modules/book/lib/Drupal/book/Tests/BookTest.php @@ -7,7 +7,7 @@ namespace Drupal\book\Tests; -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\simpletest\WebTestBase; /** diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 554b635..47c6d2b 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -9,7 +9,7 @@ * book page, etc. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\entity\Plugin\Core\Entity\EntityDisplay; use Drupal\file\Plugin\Core\Entity\File; use Drupal\Core\Entity\EntityInterface; diff --git a/core/modules/comment/comment.pages.inc b/core/modules/comment/comment.pages.inc index e333dd7..12f995c 100644 --- a/core/modules/comment/comment.pages.inc +++ b/core/modules/comment/comment.pages.inc @@ -5,7 +5,7 @@ * User page callbacks for the Comment module. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php index 45de66e..264e5fd 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php @@ -7,7 +7,7 @@ namespace Drupal\field_ui\Tests; -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; /** * Tests the functionality of the 'Manage display' screens. diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index cfc7c43..c3bca01 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -6,7 +6,7 @@ */ use Drupal\Core\Entity\EntityInterface; -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\entity\Plugin\Core\Entity\EntityDisplay; use Drupal\taxonomy\Plugin\Core\Entity\Term; diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php index 567eb3b..37e9365 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -7,7 +7,7 @@ namespace Drupal\forum\Tests; -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\simpletest\WebTestBase; /** diff --git a/core/modules/history/history.module b/core/modules/history/history.module index 45027fe..db57e10 100644 --- a/core/modules/history/history.module +++ b/core/modules/history/history.module @@ -9,7 +9,7 @@ * - Generic helper for node_mark(). */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; /** * Entities changed before this time are always shown as read. diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index 7e26d50..01ee036 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -11,7 +11,7 @@ * URLs to be added to the main site navigation menu. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\block\Plugin\Core\Entity\Block; use Drupal\system\Plugin\Core\Entity\Menu; use Drupal\system\Plugin\block\block\SystemMenuBlock; diff --git a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php b/core/modules/node/lib/Drupal/node/Entity/Type/Node.php similarity index 97% rename from core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php rename to core/modules/node/lib/Drupal/node/Entity/Type/Node.php index a78309b..370cfff 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Entity/Type/Node.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\node\Plugin\Core\Entity\Node. + * Definition of Drupal\node\Entity\Type\Node. */ -namespace Drupal\node\Plugin\Core\Entity; +namespace Drupal\node\Entity\Type; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\Entity; diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php index 5e5b270..456d880 100644 --- a/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -543,12 +543,12 @@ function hook_node_insert(Drupal\node\Node $node) { * This hook runs after a new node object has just been instantiated. It can be * used to set initial values, e.g. to provide defaults. * - * @param \Drupal\node\Plugin\Core\Entity\Node $node + * @param \Drupal\node\Entity\Type\Node $node * The node object. * * @ingroup node_api_hooks */ -function hook_node_create(\Drupal\node\Plugin\Core\Entity\Node $node) { +function hook_node_create(\Drupal\node\Entity\Type\Node $node) { if (!isset($node->foo)) { $node->foo = 'some_initial_value'; } @@ -851,7 +851,7 @@ function hook_node_submit(Drupal\node\Node $node, $form, &$form_state) { * the RSS item generated for this node. * For details on how this is used, see node_feed(). * - * @param \Drupal\node\Plugin\Core\Entity\Node $node + * @param \Drupal\node\Entity\Type\Node $node * The node that is being assembled for rendering. * @param \Drupal\entity\Plugin\Core\Entity\EntityDisplay $display * The entity_display object holding the display options configured for the @@ -867,7 +867,7 @@ function hook_node_submit(Drupal\node\Node $node, $form, &$form_state) { * * @ingroup node_api_hooks */ -function hook_node_view(\Drupal\node\Plugin\Core\Entity\Node $node, \Drupal\entity\Plugin\Core\Entity\EntityDisplay $display, $view_mode, $langcode) { +function hook_node_view(\Drupal\node\Entity\Type\Node $node, \Drupal\entity\Plugin\Core\Entity\EntityDisplay $display, $view_mode, $langcode) { // Only do the extra work if the component is configured to be displayed. // This assumes a 'mymodule_addition' extra field has been defined for the // node type in hook_field_extra_fields(). @@ -894,7 +894,7 @@ function hook_node_view(\Drupal\node\Plugin\Core\Entity\Node $node, \Drupal\enti * * @param $build * A renderable array representing the node content. - * @param \Drupal\node\Plugin\Core\Entity\Node $node + * @param \Drupal\node\Entity\Type\Node $node * The node being rendered. * @param \Drupal\entity\Plugin\Core\Entity\EntityDisplay $display * The entity_display object holding the display options configured for the @@ -905,7 +905,7 @@ function hook_node_view(\Drupal\node\Plugin\Core\Entity\Node $node, \Drupal\enti * * @ingroup node_api_hooks */ -function hook_node_view_alter(&$build, \Drupal\node\Plugin\Core\Entity\Node $node, \Drupal\entity\Plugin\Core\Entity\EntityDisplay $display) { +function hook_node_view_alter(&$build, \Drupal\node\Entity\Type\Node $node, \Drupal\entity\Plugin\Core\Entity\EntityDisplay $display) { if ($build['#view_mode'] == 'full' && isset($build['an_additional_field'])) { // Change its weight. $build['an_additional_field']['#weight'] = -10; @@ -1309,7 +1309,7 @@ function hook_validate(Drupal\node\Node $node, $form, &$form_state) { * that the node type module can define a custom method for display, or add to * the default display. * - * @param \Drupal\node\Plugin\Core\Entity\Node $node + * @param \Drupal\node\Entity\Type\Node $node * The node to be displayed, as returned by node_load(). * @param \Drupal\entity\Plugin\Core\Entity\EntityDisplay $display * The entity_display object holding the display options configured for the @@ -1330,7 +1330,7 @@ function hook_validate(Drupal\node\Node $node, $form, &$form_state) { * * @ingroup node_api_hooks */ -function hook_view(\Drupal\node\Plugin\Core\Entity\Node $node, \Drupal\entity\Plugin\Core\Entity\EntityDisplay $display, $view_mode) { +function hook_view(\Drupal\node\Entity\Type\Node $node, \Drupal\entity\Plugin\Core\Entity\EntityDisplay $display, $view_mode) { if ($view_mode == 'full' && node_is_page($node)) { $breadcrumb = array(); $breadcrumb[] = l(t('Home'), NULL); diff --git a/core/modules/node/node.module b/core/modules/node/node.module index b64a1dc..2211f3f 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -16,7 +16,7 @@ use Drupal\Core\Database\Query\SelectInterface; use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Template\Attribute; -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\file\Plugin\Core\Entity\File; use Drupal\Core\Entity\EntityInterface; use Drupal\entity\Plugin\Core\Entity\EntityDisplay; diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index 245fef7..2c52368 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -9,7 +9,7 @@ * @see node_menu() */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; /** * Page callback: Presents the node editing form. diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module index 4efee88..50124e5 100644 --- a/core/modules/node/tests/modules/node_access_test/node_access_test.module +++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module @@ -9,7 +9,7 @@ * a special 'node test view' permission. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; /** * Implements hook_node_grants(). diff --git a/core/modules/node/tests/modules/node_test/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module index 36b59c9..fe7402e 100644 --- a/core/modules/node/tests/modules/node_test/node_test.module +++ b/core/modules/node/tests/modules/node_test/node_test.module @@ -8,7 +8,7 @@ * interaction with the Node module. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\entity\Plugin\Core\Entity\EntityDisplay; /** diff --git a/core/modules/node/tests/modules/node_test_exception/node_test_exception.module b/core/modules/node/tests/modules/node_test_exception/node_test_exception.module index 359af1f..c3d3d95 100644 --- a/core/modules/node/tests/modules/node_test_exception/node_test_exception.module +++ b/core/modules/node/tests/modules/node_test_exception/node_test_exception.module @@ -5,7 +5,7 @@ * A module implementing node related hooks to test API interaction. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; /** * Implements hook_node_insert(). diff --git a/core/modules/path/path.module b/core/modules/path/path.module index 7521dee..5945ec4 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -5,7 +5,7 @@ * Enables users to rename URLs. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\taxonomy\Plugin\Core\Entity\Term; diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php index 45488bd..88218ac 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php @@ -7,7 +7,7 @@ namespace Drupal\rdf\Tests; -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\simpletest\WebTestBase; /** diff --git a/core/modules/search/search.module b/core/modules/search/search.module index a465e3a..2dda82f 100644 --- a/core/modules/search/search.module +++ b/core/modules/search/search.module @@ -5,7 +5,7 @@ * Enables site-wide keyword searching. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; /** * Matches all 'N' Unicode character classes (numbers) diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module index f6a9d48..748e540 100644 --- a/core/modules/statistics/statistics.module +++ b/core/modules/statistics/statistics.module @@ -5,7 +5,7 @@ * Logs and displays content statistics for a site. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\entity\Plugin\Core\Entity\EntityDisplay; /** diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 16d1019..741ce4d 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -5,7 +5,7 @@ * Enables the organization of content into categories. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\taxonomy\Plugin\Core\Entity\Term; use Drupal\taxonomy\Plugin\Core\Entity\Vocabulary; use Drupal\Core\Entity\EntityInterface; @@ -1406,7 +1406,7 @@ function taxonomy_node_insert(Node $node) { * The index lists all terms that are related to a given node entity, and is * therefore maintained at the entity level. * - * @param \Drupal\node\Plugin\Core\Entity\Node $node + * @param \Drupal\node\Entity\Type\Node $node * The node entity. */ function taxonomy_build_node_index($node) { @@ -1489,7 +1489,7 @@ function taxonomy_node_predelete(Node $node) { /** * Deletes taxonomy index entries for a given node. * - * @param Drupal\node\Plugin\Core\Entity\Node $node + * @param Drupal\node\Entity\Type\Node $node * The node entity. */ function taxonomy_delete_node_index(Node $node) { diff --git a/core/modules/tracker/tracker.module b/core/modules/tracker/tracker.module index 4517021..86803e8 100644 --- a/core/modules/tracker/tracker.module +++ b/core/modules/tracker/tracker.module @@ -5,7 +5,7 @@ * Tracks recent content posted by a user or users. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; /** * Implements hook_help(). diff --git a/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php b/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php index 5dfd181..555519a 100644 --- a/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php +++ b/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php @@ -7,7 +7,7 @@ namespace Drupal\translation\Tests; -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\simpletest\WebTestBase; /** diff --git a/core/modules/translation/tests/translation_test.module b/core/modules/translation/tests/translation_test.module index 8c9fdf2..0ab2910 100644 --- a/core/modules/translation/tests/translation_test.module +++ b/core/modules/translation/tests/translation_test.module @@ -5,7 +5,7 @@ * Mock module for content translation tests. */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; /** * Implements hook_node_insert(). diff --git a/core/modules/translation/translation.module b/core/modules/translation/translation.module index 805b58f..9823ef1 100644 --- a/core/modules/translation/translation.module +++ b/core/modules/translation/translation.module @@ -19,7 +19,7 @@ * date (0) or needs to be updated (1). */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; use Drupal\entity\Plugin\Core\Entity\EntityDisplay; /** diff --git a/core/modules/translation/translation.pages.inc b/core/modules/translation/translation.pages.inc index 53b91c8..3df12c9 100644 --- a/core/modules/translation/translation.pages.inc +++ b/core/modules/translation/translation.pages.inc @@ -6,7 +6,7 @@ */ use Drupal\Component\Utility\NestedArray; -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\node\Entity\Type\Node; /** * Page callback: Displays a list of a node's translations.