FlagTypePluginManager.php in Flag 8.4
File
src/FlagType/FlagTypePluginManager.php
View source
<?php
namespace Drupal\flag\FlagType;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
class FlagTypePluginManager extends DefaultPluginManager {
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
parent::__construct('Plugin/Flag', $namespaces, $module_handler, 'Drupal\\flag\\FlagType\\FlagTypePluginInterface', 'Drupal\\flag\\Annotation\\FlagType');
$this
->alterInfo('flag_type_info');
$this
->setCacheBackend($cache_backend, 'flag');
}
public function getAllFlagTypes() {
$flag_types = [];
foreach ($this
->getDefinitions() as $plugin_id => $plugin_def) {
$flag_types[$plugin_id] = $plugin_def['title'];
}
asort($flag_types);
return $flag_types;
}
}