class IconExtractorPluginManager
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Theme/Icon/IconExtractorPluginManager.php \Drupal\Core\Theme\Icon\IconExtractorPluginManager
IconExtractor plugin manager.
@internal Icon is currently experimental and should only be leveraged by experimental modules and development releases of contributed modules. See https://www.drupal.org/core/experimental for more information.
Hierarchy
- class \Drupal\Component\Plugin\PluginManagerBase implements \Drupal\Component\Plugin\PluginManagerInterface uses \Drupal\Component\Plugin\Discovery\DiscoveryTrait
- class \Drupal\Core\Plugin\DefaultPluginManager implements \Drupal\Component\Plugin\PluginManagerInterface, \Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait, \Drupal\Core\Cache\UseCacheBackendTrait extends \Drupal\Component\Plugin\PluginManagerBase
- class \Drupal\Core\Theme\Icon\IconExtractorPluginManager extends \Drupal\Core\Plugin\DefaultPluginManager
- class \Drupal\Core\Plugin\DefaultPluginManager implements \Drupal\Component\Plugin\PluginManagerInterface, \Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait, \Drupal\Core\Cache\UseCacheBackendTrait extends \Drupal\Component\Plugin\PluginManagerBase
Expanded class hierarchy of IconExtractorPluginManager
2 files declare their use of IconExtractorPluginManager
- IconPackManager.php in core/
lib/ Drupal/ Core/ Theme/ Icon/ Plugin/ IconPackManager.php - IconPackManagerTest.php in core/
tests/ Drupal/ Tests/ Core/ Theme/ Icon/ IconPackManagerTest.php
1 string reference to 'IconExtractorPluginManager'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses IconExtractorPluginManager
File
-
core/
lib/ Drupal/ Core/ Theme/ Icon/ IconExtractorPluginManager.php, line 23
Namespace
Drupal\Core\Theme\IconView source
class IconExtractorPluginManager extends DefaultPluginManager {
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, protected readonly PluginFormFactoryInterface $pluginFormFactory) {
parent::__construct('Plugin/IconExtractor', $namespaces, $module_handler, IconExtractorInterface::class, IconExtractor::class);
$this->alterInfo('icon_extractor_info');
$this->setCacheBackend($cache_backend, 'icon_extractor_plugins');
}
/**
* Get multiple extractor settings form.
*
* @param array $icon_pack_configurations
* All the icon pack configurations containing the extractor.
*
* @return \Drupal\Core\Plugin\PluginFormInterface[]
* The extractor form indexed by extractor id.
*/
public function getExtractorForms(array $icon_pack_configurations) : array {
$extractor_forms = [];
foreach ($icon_pack_configurations as $icon_pack_configuration) {
$pack_id = $icon_pack_configuration['id'];
$form = $this->getExtractorForm($icon_pack_configuration);
if (NULL === $form) {
continue;
}
$extractor_forms[$pack_id] = $form;
}
return $extractor_forms;
}
/**
* Get an extractor settings form.
*
* @param array $icon_pack_configuration
* The extractor configuration.
*
* @return \Drupal\Core\Plugin\PluginFormInterface|null
* The extractor form or null.
*/
public function getExtractorForm(array $icon_pack_configuration) : ?PluginFormInterface {
if (!isset($icon_pack_configuration['settings'])) {
return NULL;
}
/** @var \Drupal\Core\Theme\Icon\IconExtractorInterface $plugin */
$plugin = $this->createInstance($icon_pack_configuration['extractor'], $icon_pack_configuration);
return $this->getPluginForm($plugin);
}
/**
* Retrieves the plugin form for a given icon extractor.
*
* @param \Drupal\Core\Theme\Icon\IconExtractorInterface $icon_extractor
* The ui icons extractor plugin.
*
* @return \Drupal\Core\Plugin\PluginFormInterface
* The plugin form for this plugin.
*/
protected function getPluginForm(IconExtractorInterface $icon_extractor) : PluginFormInterface {
if ($icon_extractor instanceof PluginWithFormsInterface) {
return $this->pluginFormFactory
->createInstance($icon_extractor, 'settings');
}
return $icon_extractor;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.