function IconPackManager::getIcons

Overrides IconPackManagerInterface::getIcons

File

core/lib/Drupal/Core/Theme/Icon/Plugin/IconPackManager.php, line 240

Class

IconPackManager
Defines an icon pack plugin manager to deal with icons.

Namespace

Drupal\Core\Theme\Icon\Plugin

Code

public function getIcons(array $allowed_icon_pack = []) : array {
    $definitions = $this->getDefinitions();
    if (NULL === $definitions) {
        return [];
    }
    $icons = [];
    foreach ($definitions as $definition) {
        if ($allowed_icon_pack && !in_array($definition['id'], $allowed_icon_pack, TRUE)) {
            continue;
        }
        $icons = array_merge($icons, $definition['icons'] ?? []);
    }
    return $icons;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.