function AnnotationBridgeDecorator::getDefinitions

Same name in other branches
  1. 9 core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecorator.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator::getDefinitions()
  2. 8.9.x core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecorator.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator::getDefinitions()
  3. 11.x core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecorator.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator::getDefinitions()

Overrides DiscoveryTrait::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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.