class AnnotatedClassDiscovery in Typed Data API enhancements 8
Extends the annotation class discovery for usage with Typed Data context.
We modify the annotations classes for ContextDefinition and for Condition. This class makes sure that our plugin managers apply these.
Hierarchy
- class \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery implements DiscoveryInterface uses DiscoveryTrait
- class \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery
- class \Drupal\typed_data\Context\AnnotatedClassDiscovery
- class \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery
Expanded class hierarchy of AnnotatedClassDiscovery
File
- src/
Context/ AnnotatedClassDiscovery.php, line 14
Namespace
Drupal\typed_data\ContextView source
class AnnotatedClassDiscovery extends CoreAnnotatedClassDiscovery {
/**
* {@inheritdoc}
*/
protected function getAnnotationReader() {
if (!isset($this->annotationReader)) {
// Do not call out the parent, but re-configure the simple annotation
// reader on our own, so we can control the order of namespaces.
$this->annotationReader = new SimpleAnnotationReader();
// Make sure to add our namespace first, so our ContextDefinition and
// Condition annotations gets picked.
$this->annotationReader
->addNamespace('Drupal\\typed_data\\Context\\Annotation');
// Add the namespaces from the main plugin annotation, like @EntityType.
$namespace = mb_substr($this->pluginDefinitionAnnotationName, 0, mb_strrpos($this->pluginDefinitionAnnotationName, '\\'));
$this->annotationReader
->addNamespace($namespace);
// Add general core annotations like @Translation.
$this->annotationReader
->addNamespace('Drupal\\Core\\Annotation');
}
return $this->annotationReader;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AnnotatedClassDiscovery:: |
protected | property | Additional namespaces to be scanned for annotation classes. | |
AnnotatedClassDiscovery:: |
protected | property | The doctrine annotation reader. | |
AnnotatedClassDiscovery:: |
protected | property | A suffix to append to each PSR-4 directory associated with a base namespace, to form the directories where plugins are found. | |
AnnotatedClassDiscovery:: |
protected | property | The file cache object. | |
AnnotatedClassDiscovery:: |
protected | property | A suffix to append to each base namespace, to obtain the namespaces where plugins are found. | |
AnnotatedClassDiscovery:: |
protected | property | The name of the annotation that contains the plugin definition. | |
AnnotatedClassDiscovery:: |
protected | property | The namespaces within which to find plugin classes. | |
AnnotatedClassDiscovery:: |
protected | property | A list of base namespaces with their PSR-4 directories. | |
AnnotatedClassDiscovery:: |
protected | function |
Gets the used doctrine annotation reader. Overrides AnnotatedClassDiscovery:: |
|
AnnotatedClassDiscovery:: |
public | function |
Gets the definition of all plugins for this type. Overrides DiscoveryTrait:: |
1 |
AnnotatedClassDiscovery:: |
protected | function |
Gets an array of PSR-4 namespaces to search for plugin classes. Overrides AnnotatedClassDiscovery:: |
|
AnnotatedClassDiscovery:: |
protected | function | Extracts the provider name from a Drupal namespace. | |
AnnotatedClassDiscovery:: |
protected | function |
Prepares the annotation definition. Overrides AnnotatedClassDiscovery:: |
2 |
AnnotatedClassDiscovery:: |
public | function |
Constructs an AnnotatedClassDiscovery object. Overrides AnnotatedClassDiscovery:: |
2 |
DiscoveryTrait:: |
protected | function | Gets a specific plugin definition. | |
DiscoveryTrait:: |
public | function | 3 | |
DiscoveryTrait:: |
public | function |