Lines: 100.00%
| Line | Hits | Source |
|---|---|---|
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Drupal\visitors; | |
| 6 | ||
| 7 | use Drupal\Core\Cache\CacheBackendInterface; | |
| 8 | use Drupal\Core\Extension\ModuleHandlerInterface; | |
| 9 | use Drupal\Core\Plugin\DefaultPluginManager; | |
| 10 | ||
| 11 | /** | |
| 12 | * Plugin manager for visit location plugins. | |
| 13 | */ | |
| 14 | class VisitorsLocationPluginManager extends DefaultPluginManager { | |
| 15 | ||
| 16 | /** | |
| 17 | * Constructs a VisitorsLocationPluginManager. | |
| 18 | * | |
| 19 | * @param \Traversable $namespaces | |
| 20 | * An object that implements \Traversable which contains the root paths | |
| 21 | * keyed by the corresponding namespace to look for plugin implementations. | |
| 22 | * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend | |
| 23 | * Cache backend instance to use. | |
| 24 | * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler | |
| 25 | * The module handler to invoke the alter hook with. | |
| 26 | */ | |
| 27 | public function __construct( | |
| 28 | \Traversable $namespaces, | |
| 29 | CacheBackendInterface $cache_backend, | |
| 30 | ModuleHandlerInterface $module_handler, | |
| 31 | ) { | |
| 32 | 11 | parent::__construct( |
| 33 | 11 | 'Plugin/VisitorsLocation', |
| 34 | 11 | $namespaces, |
| 35 | 11 | $module_handler, |
| 36 | 11 | 'Drupal\visitors\VisitorsLocationPluginInterface', |
| 37 | 11 | 'Drupal\visitors\Attribute\VisitorsLocation', |
| 38 | 11 | ); |
| 39 | ||
| 40 | 11 | $this->alterInfo('visitors_location_info'); |
| 41 | 11 | $this->setCacheBackend($cache_backend, 'visitors_location_plugins'); |
| 42 | } | |
| 43 | ||
| 44 | } |