function template_preprocess_aggregator_item in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/aggregator/aggregator.theme.inc \template_preprocess_aggregator_item()
Prepares variables for aggregator item templates.
Default template: aggregator-item.html.twig.
Parameters
array $variables: An associative array containing:
- elements: An array of elements to display in view mode.
File
- core/
modules/ aggregator/ aggregator.theme.inc, line 20 - Preprocessors and theme functions of Aggregator module.
Code
function template_preprocess_aggregator_item(&$variables) {
$item = $variables['elements']['#aggregator_item'];
// Helpful $content variable for templates.
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
$variables['url'] = UrlHelper::stripDangerousProtocols($item
->getLink());
$variables['title'] = $item
->label();
}