You are here

protected function AnnotatedClassDiscovery::getAnnotationReader in Plug 7

Same name in this branch
  1. 7 lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::getAnnotationReader()
  2. 7 lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery::getAnnotationReader()

Gets the used doctrine annotation reader.

Return value

\Doctrine\Common\Annotations\Reader The annotation reader.

Overrides AnnotatedClassDiscovery::getAnnotationReader

File

lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php, line 74
Contains \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery.

Class

AnnotatedClassDiscovery
Defines a discovery mechanism to find annotated plugins in PSR-0 namespaces.

Namespace

Drupal\Core\Plugin\Discovery

Code

protected function getAnnotationReader() {
  if (!isset($this->annotationReader)) {
    $reader = parent::getAnnotationReader();

    // Add the Core annotation classes like @Translation.
    $reader
      ->addNamespace('Drupal\\Core\\Annotation', array(
      dirname(dirname(__DIR__)) . '/Annotation',
    ));
    $this->annotationReader = $reader;
  }
  return $this->annotationReader;
}