diff --git a/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php b/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php index 9fa07163678a0cfd5603c00b0b0efd85aefbd054..9ae0b996c445898deffad28f1fdf9876552f060a 100644 --- a/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php +++ b/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php @@ -5,6 +5,7 @@ use Drupal\Core\Database\Database; use Drupal\Core\Form\FormStateInterface; use Drupal\taxonomy\VocabularyStorageInterface; +use Drupal\views\Attribute\ViewsRelationship; use Drupal\views\Plugin\views\relationship\RelationshipPluginBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -12,9 +13,8 @@ * Relationship handler to return the taxonomy terms of nodes. * * @ingroup views_relationship_handlers - * - * @ViewsRelationship("node_term_data") */ +#[ViewsRelationship("node_term_data")] class NodeTermData extends RelationshipPluginBase { /** diff --git a/core/modules/views/src/Attribute/ViewsRelationship.php b/core/modules/views/src/Attribute/ViewsRelationship.php new file mode 100644 index 0000000000000000000000000000000000000000..fd8fe1f18dee83098c23d8fa942ef551f8795018 --- /dev/null +++ b/core/modules/views/src/Attribute/ViewsRelationship.php @@ -0,0 +1,19 @@ +<?php + +declare(strict_types=1); + +namespace Drupal\views\Attribute; + +use Drupal\Component\Plugin\Attribute\PluginID; + +/** + * Defines a Plugin attribute class for views relationship handlers. + * + * @see \Drupal\views\Plugin\views\relationship\RelationshipPluginBase + * + * @ingroup views_relationship_handlers + */ +#[\Attribute(\Attribute::TARGET_CLASS)] +class ViewsRelationship extends PluginID { + +} diff --git a/core/modules/views/src/Plugin/views/relationship/Broken.php b/core/modules/views/src/Plugin/views/relationship/Broken.php index e3285fcd6b0b40cfbaff6e6a9726ab190253d54b..8538a217e60f985afdaa488bb917499467db6245 100644 --- a/core/modules/views/src/Plugin/views/relationship/Broken.php +++ b/core/modules/views/src/Plugin/views/relationship/Broken.php @@ -2,15 +2,15 @@ namespace Drupal\views\Plugin\views\relationship; +use Drupal\views\Attribute\ViewsRelationship; use Drupal\views\Plugin\views\BrokenHandlerTrait; /** * A special handler to take the place of missing or broken handlers. * * @ingroup views_relationship_handlers - * - * @ViewsRelationship("broken") */ +#[ViewsRelationship("broken")] class Broken extends RelationshipPluginBase { use BrokenHandlerTrait; diff --git a/core/modules/views/src/Plugin/views/relationship/EntityReverse.php b/core/modules/views/src/Plugin/views/relationship/EntityReverse.php index 64c3d7055784002e2721ffb59828fb404feb7e36..123b5c0dd4bbe6689b6a8c3dee414bbfda281ec4 100644 --- a/core/modules/views/src/Plugin/views/relationship/EntityReverse.php +++ b/core/modules/views/src/Plugin/views/relationship/EntityReverse.php @@ -2,6 +2,7 @@ namespace Drupal\views\Plugin\views\relationship; +use Drupal\views\Attribute\ViewsRelationship; use Drupal\views\Plugin\ViewsHandlerManager; use Drupal\views\Views; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -10,9 +11,8 @@ * A relationship handlers which reverse entity references. * * @ingroup views_relationship_handlers - * - * @ViewsRelationship("entity_reverse") */ +#[ViewsRelationship("entity_reverse")] class EntityReverse extends RelationshipPluginBase { /** diff --git a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php index be72d1da36935e5da2f54fb0c5f22881bcad0017..61cabe3e26f88fe5b337616b5f9fafae2ff06c0b 100644 --- a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php +++ b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php @@ -4,6 +4,7 @@ use Drupal\Core\Database\Query\AlterableInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\views\Attribute\ViewsRelationship; use Drupal\views\Views; use Drupal\views\Entity\View; @@ -56,9 +57,8 @@ * in the same way as node_comment_statistics. * * @ingroup views_relationship_handlers - * - * @ViewsRelationship("groupwise_max") */ +#[ViewsRelationship("groupwise_max")] class GroupwiseMax extends RelationshipPluginBase { /** diff --git a/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php b/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php index 8774b81cef1414671d32f41e041f1162dd15bb64..deafd82f40570b4d9abb584b3fd33587c6169ef3 100644 --- a/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php +++ b/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php @@ -15,7 +15,7 @@ * * Relationship handlers extend * \Drupal\views\Plugin\views\relationship\RelationshipPluginBase. They must - * be annotated with \Drupal\views\Annotation\ViewsRelationship annotation, + * be attributed with \Drupal\views\Attribute\ViewsRelationship attribute, * and they must be in namespace directory Plugin\views\relationship. * * @ingroup views_plugins diff --git a/core/modules/views/src/Plugin/views/relationship/Standard.php b/core/modules/views/src/Plugin/views/relationship/Standard.php index 817a9ad7af26fd67eebea0d695eeb2a7ca797b96..3637d57189e7cf09d9c48c2541bad68a16cd76f2 100644 --- a/core/modules/views/src/Plugin/views/relationship/Standard.php +++ b/core/modules/views/src/Plugin/views/relationship/Standard.php @@ -2,13 +2,14 @@ namespace Drupal\views\Plugin\views\relationship; +use Drupal\views\Attribute\ViewsRelationship; + /** * Default implementation of the base relationship plugin. * * @ingroup views_relationship_handlers - * - * @ViewsRelationship("standard") */ +#[ViewsRelationship("standard")] class Standard extends RelationshipPluginBase { }