function template_preprocess_filter_tips
Same name in other branches
- 9 core/modules/filter/filter.module \template_preprocess_filter_tips()
- 8.9.x core/modules/filter/filter.module \template_preprocess_filter_tips()
- 11.x core/modules/filter/filter.module \template_preprocess_filter_tips()
Prepares variables for filter tips templates.
Default template: filter-tips.html.twig.
Parameters
array $variables: An associative array containing:
- tips: An array containing descriptions and a CSS ID in the form of 'module-name/filter-id' (only used when $long is TRUE) for each filter in one or more text formats. Example:
[
'Full HTML' => [
0 => [
'tip' => 'Web page addresses and email addresses turn into links automatically.',
'id' => 'filter/2',
],
],
];
- long: (optional) Whether the passed-in filter tips contain extended explanations, i.e. intended to be output on the path 'filter/tips' (TRUE), or are in a short format, i.e. suitable to be displayed below a form element. Defaults to FALSE.
File
-
core/
modules/ filter/ filter.module, line 421
Code
function template_preprocess_filter_tips(&$variables) {
$tips = $variables['tips'];
foreach ($variables['tips'] as $name => $tip_list) {
foreach ($tip_list as $tip_key => $tip) {
$tip_list[$tip_key]['attributes'] = new Attribute();
}
$variables['tips'][$name] = [
'attributes' => new Attribute(),
'name' => $name,
'list' => $tip_list,
];
}
$variables['multiple'] = count($tips) > 1;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.