Newer
Older
Dries Buytaert
committed
<?php
/**
* @file
* Contains \Drupal\tour\TipPluginManager.
Dries Buytaert
committed
*/
namespace Drupal\tour;
use Drupal\Component\Plugin\PluginManagerBase;
use Drupal\Component\Plugin\Factory\DefaultFactory;
use Drupal\Core\Plugin\Discovery\AlterDecorator;
Dries Buytaert
committed
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
use Drupal\Core\Plugin\Discovery\CacheDecorator;
use Drupal\Component\Plugin\Discovery\ProcessDecorator;
/**
* Configurable tour manager.
Dries Buytaert
committed
*/
class TipPluginManager extends PluginManagerBase {
Dries Buytaert
committed
/**
* Overrides \Drupal\Component\Plugin\PluginManagerBase::__construct().
* @param \Traversable $namespaces
* An object that implements \Traversable which contains the root paths
* keyed by the corresponding namespace to look for plugin implementations,
Dries Buytaert
committed
*/
public function __construct(\Traversable $namespaces) {
$annotation_namespaces = array('Drupal\tour\Annotation' => $namespaces['Drupal\tour']);
$this->discovery = new AnnotatedClassDiscovery('tour/tip', $namespaces, $annotation_namespaces, 'Drupal\tour\Annotation\Tip');
$this->discovery = new AlterDecorator($this->discovery, 'tour_tips_info');
Dries Buytaert
committed
$this->discovery = new CacheDecorator($this->discovery, 'tour');
Dries Buytaert
committed
Dries Buytaert
committed
$this->factory = new DefaultFactory($this->discovery);
}
}