You are here

function template_preprocess_bibcite_keyword in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/bibcite_entity.module \template_preprocess_bibcite_keyword()

Prepares variables for keyword templates.

Default template: bibcite-keyword.html.twig.

Parameters

array $variables: An associative array containing:

  • elements: An array of elements to display in view mode.
  • attributes: HTML attributes for the containing element.
  • bibcite_keyword: The keyword object.
  • view_mode: View mode.

File

modules/bibcite_entity/bibcite_entity.module, line 294
Module hooks.

Code

function template_preprocess_bibcite_keyword(array &$variables) {
  $variables['view_mode'] = $variables['elements']['#view_mode'];
  $variables['bibcite_keyword'] = $variables['elements']['#bibcite_keyword'];
  $variables += [
    'content' => [],
  ];
  foreach (Element::children($variables['elements']) as $key) {
    $variables['content'][$key] = $variables['elements'][$key];
  }
  $variables['attributes']['class'][] = 'bibcite-keyword';
}