template_preprocess_aggregator_item

template_preprocess_aggregator_item(&$variables)

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

1
2
3
4
5
6
7
8
9
10
11
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();
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.