You are here

public function AnnotationBridgeDecorator::getDefinitions in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecorator.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator::getDefinitions()

Gets the definition of all plugins for this type.

Return value

mixed[] An array of plugin definitions (empty array if no definitions were found). Keys are plugin IDs.

Overrides DiscoveryTrait::getDefinitions

See also

\Drupal\Core\Plugin\FilteredPluginManagerInterface::getFilteredDefinitions()

File

core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecorator.php, line 47

Class

AnnotationBridgeDecorator
Ensures that all definitions are run through the annotation process.

Namespace

Drupal\Component\Annotation\Plugin\Discovery

Code

public function getDefinitions() {
  $definitions = $this->decorated
    ->getDefinitions();
  foreach ($definitions as $id => $definition) {

    // Annotation constructors expect an array of values. If the definition is
    // not an array, it usually means it has been processed already and can be
    // ignored.
    if (is_array($definition)) {
      $definitions[$id] = (new $this->pluginDefinitionAnnotationName($definition))
        ->get();
    }
  }
  return $definitions;
}