function AttributeDiscoveryWithAnnotations::prepareAnnotationDefinition

Same name in other branches
  1. 10 core/lib/Drupal/Core/Plugin/Discovery/AttributeDiscoveryWithAnnotations.php \Drupal\Core\Plugin\Discovery\AttributeDiscoveryWithAnnotations::prepareAnnotationDefinition()

Prepares the annotation definition.

This is a copy of the prepareAnnotationDefinition method from annotated class discovery.

Parameters

\Drupal\Component\Annotation\AnnotationInterface $annotation: The annotation derived from the plugin.

class-string $class: The class used for the plugin.

See also

\Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery::prepareAnnotationDefinition()

\Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::prepareAnnotationDefinition()

1 call to AttributeDiscoveryWithAnnotations::prepareAnnotationDefinition()
AttributeDiscoveryWithAnnotations::parseClass in core/lib/Drupal/Core/Plugin/Discovery/AttributeDiscoveryWithAnnotations.php

File

core/lib/Drupal/Core/Plugin/Discovery/AttributeDiscoveryWithAnnotations.php, line 117

Class

AttributeDiscoveryWithAnnotations
Enables both attribute and annotation discovery for plugin definitions.

Namespace

Drupal\Core\Plugin\Discovery

Code

private function prepareAnnotationDefinition(AnnotationInterface $annotation, string $class) : void {
    $annotation->setClass($class);
    if (!$annotation->getProvider()) {
        $annotation->setProvider($this->getProviderFromNamespace($class));
    }
}

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