IconProviderManager.php in Icon API 8
File
src/IconProviderManager.php
View source
<?php
namespace Drupal\icon;
use Drupal\Component\Serialization\Yaml;
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\Theme\ThemeManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class IconProviderManager extends IconBasePluginManager {
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, ThemeManagerInterface $theme_manager) {
parent::__construct($namespaces, $cache_backend, $module_handler, $theme_handler, $theme_manager, 'Drupal\\icon\\Plugin\\Icon\\IconProviderInterface', 'Drupal\\icon\\Annotation\\IconProvider');
$this
->alterInfo('icon_provider_handler_info');
$this
->setCacheBackend($cache_backend, 'icon_provider_handler_info');
}
public static function create(ContainerInterface $container) {
return new static($container
->get('container.namespaces'), $container
->get('cache.discovery'), $container
->get('module_handler'), $container
->get('theme_handler'), $container
->get('theme.manager'));
}
protected function findDefinitions() {
$definitions = parent::findDefinitions();
if (isset($definitions['default'])) {
$definitions = [
'default' => $definitions['default'],
] + $definitions;
}
return $definitions;
}
public function getInstances() {
$instances = [];
foreach (array_keys($this
->getDefinitions()) as $plugin_id) {
$instances[$plugin_id] = $this
->createInstance($plugin_id);
}
return $instances;
}
}