function IconDefinition::getRenderable
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Theme/Icon/IconDefinition.php \Drupal\Core\Theme\Icon\IconDefinition::getRenderable()
1 call to IconDefinition::getRenderable()
- IconDefinitionTest::testGetRenderable in core/
tests/ Drupal/ Tests/ Core/ Theme/ Icon/ IconDefinitionTest.php - Test the IconDefinition::getRenderable method.
File
-
core/
lib/ Drupal/ Core/ Theme/ Icon/ IconDefinition.php, line 103
Class
- IconDefinition
- Handle an icon definition.
Namespace
Drupal\Core\Theme\IconCode
public static function getRenderable(string $icon_full_id, array $settings = []) : ?array {
if (!$icon_data = self::getIconDataFromId($icon_full_id)) {
return NULL;
}
if (isset($settings[$icon_data['pack_id']])) {
$settings = $settings[$icon_data['pack_id']];
}
return [
'#type' => 'icon',
'#pack_id' => $icon_data['pack_id'],
'#icon_id' => $icon_data['icon_id'],
'#settings' => $settings,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.