function IconsTwigExtension::getIconRenderable
Get an icon renderable array.
Parameters
string|null $pack_id: The icon set ID.
string|null $icon_id: The icon ID.
array|null $settings: An array of settings for the icon.
Return value
array The icon renderable.
File
-
core/
lib/ Drupal/ Core/ Template/ IconsTwigExtension.php, line 39
Class
- IconsTwigExtension
- Twig extension for icon.
Namespace
Drupal\Core\TemplateCode
public function getIconRenderable(?string $pack_id, ?string $icon_id, ?array $settings = []) : array {
if (!$pack_id || !$icon_id) {
return [];
}
return [
'#type' => 'icon',
'#pack_id' => $pack_id,
'#icon_id' => $icon_id,
'#settings' => $settings,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.