function IconExtractorBase::createIcon
Overrides IconExtractorInterface::createIcon
3 calls to IconExtractorBase::createIcon()
- IconExtractorBase::loadIcon in core/
lib/ Drupal/ Core/ Theme/ Icon/ IconExtractorBase.php - Load an icon object.
- SvgExtractor::loadIcon in core/
lib/ Drupal/ Core/ Theme/ Plugin/ IconExtractor/ SvgExtractor.php - Load an icon object.
- TestExtractorWithFinder::discoverIcons in core/
modules/ system/ tests/ modules/ icon_test/ src/ Plugin/ IconExtractor/ TestExtractorWithFinder.php - Get a list of all the icons discovered by this extractor.
File
-
core/
lib/ Drupal/ Core/ Theme/ Icon/ IconExtractorBase.php, line 87
Class
- IconExtractorBase
- Base class for icon extractor plugins.
Namespace
Drupal\Core\Theme\IconCode
public function createIcon(string $icon_id, ?string $source = NULL, ?string $group = NULL, ?array $data = NULL) : IconDefinitionInterface {
if (!isset($this->configuration['template'])) {
throw new IconPackConfigErrorException(sprintf('Missing `template` in your definition, extractor %s requires this value.', $this->getPluginId()));
}
// Clean unused pack definition values as they will be passed to the context
// of the Twig.
$data_definition = array_diff_key($this->configuration, array_flip(self::DEFINITION_REMOVE));
return IconDefinition::create($this->configuration['id'], $icon_id, $this->configuration['template'], $source, $group, $data ? array_merge($data, $data_definition) : $data_definition);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.