Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / entityqueue / src / EntityQueueHandlerManager.php
1 <?php
2
3 namespace Drupal\entityqueue;
4
5 use Drupal\Core\Cache\CacheBackendInterface;
6 use Drupal\Core\Extension\ModuleHandlerInterface;
7 use Drupal\Core\Plugin\DefaultPluginManager;
8
9 /**
10  * Provides an EntityQueueHandler plugin manager.
11  */
12 class EntityQueueHandlerManager extends DefaultPluginManager {
13
14   /**
15    * Constructs a new EntityQueueHandlerManager.
16    *
17    * @param \Traversable $namespaces
18    *   An object that implements \Traversable which contains the root paths
19    *   keyed by the corresponding namespace to look for plugin implementations,
20    * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
21    *   Cache backend instance to use.
22    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
23    *   The module handler to invoke the alter hook with.
24    */
25   public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
26     parent::__construct('Plugin/EntityQueueHandler', $namespaces, $module_handler, null, 'Drupal\entityqueue\Annotation\EntityQueueHandler');
27
28     $this->setCacheBackend($cache_backend, 'entityqueuehandler');
29   }
30
31   /**
32    * Gets all handlers.
33    *
34    * @return array
35    *   Returns all entityqueue handlers.
36    */
37   public function getAllEntityQueueHandlers() {
38     $handlers = [];
39     foreach ($this->getDefinitions() as $plugin_id => $plugin_def) {
40       $handlers[$plugin_id] = $plugin_def['title'];
41     }
42     asort($handlers);
43
44     return $handlers;
45   }
46
47 }