Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By benjy on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.1.x
Introduced in version:
8.1.0
Issue links:
Description:
Previously it was not possible for annotations to extend other annotations. This is now possible by passing an array of $annotation_namespaces
to \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery
. This is also available on \Drupal\Core\Plugin\DefaultPluginManager
Example:
public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, $annotation = 'Drupal\Component\Annotation\PluginID') {
$plugin_interface = 'Drupal\my_module\MyPluginInterface';
$annotation_namespaces = ['Drupal\my_module\Plugin\Annotation', 'Drupal\my_module_two\Plugin\Annotation'];
parent::__construct("Plugin/migrate/$type", $namespaces, $module_handler, $plugin_interface, $annotation, $annotation_namespaces);
}
Impacts:
Module developers