function template_preprocess_micon_package in Micon 8
Same name and namespace in other branches
- 2.x micon.theme.inc \template_preprocess_micon_package()
Prepares variables for Micon package templates.
Default template: micon-package.html.twig.
Parameters
array $variables: An associative array containing:
- element: An associative array containing the icon
- attributes: HTML attributes for the containing element.
File
- ./
micon.theme.inc, line 75 - Contains micon.theme.inc.
Code
function template_preprocess_micon_package(array &$variables) {
$variables['micon'] = $micon = $variables['element']['#micon'];
$variables['type'] = $micon
->type();
// Helpful $content variable for templates.
$variables['content'] = [];
foreach (Element::children($variables['element']) as $key) {
$variables['content'][$key] = $variables['element'][$key];
}
$function = 'micon_template_preprocess_micon_package__' . $variables['type'];
if (function_exists($function)) {
$function($variables);
}
}