You are here

public function AnnotationBridgeDecorator::getDefinitions in Drupal 10

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()
  2. 9 core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecorator.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator::getDefinitions()

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;
}