function IconPackManager::listIconPackOptions
Overrides IconPackManagerInterface::listIconPackOptions
File
-
core/
lib/ Drupal/ Core/ Theme/ Icon/ Plugin/ IconPackManager.php, line 328
Class
- IconPackManager
- Defines an icon pack plugin manager to deal with icons.
Namespace
Drupal\Core\Theme\Icon\PluginCode
public function listIconPackOptions(bool $include_description = FALSE) : array {
$icon_pack_definitions = $this->getDefinitions();
if (NULL === $icon_pack_definitions) {
return [];
}
$options = [];
foreach ($icon_pack_definitions as $definition) {
if (empty($definition['icons'])) {
continue;
}
$label = $definition['label'] ?? $definition['id'];
if ($include_description && isset($definition['description'])) {
$label = sprintf('%s - %s', $label, $definition['description']);
}
$options[$definition['id']] = sprintf('%s (%u)', $label, count($definition['icons']));
}
natsort($options);
return $options;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.