function template_preprocess_bibcite_reference in Bibliography & Citation 2.0.x
Same name and namespace in other branches
- 8 modules/bibcite_entity/bibcite_entity.module \template_preprocess_bibcite_reference()
Prepares variables for reference templates.
Default template: bibcite-reference.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_reference: The reference object.
- view_mode: View mode; e.g., 'default', 'citation', etc.
File
- modules/
bibcite_entity/ bibcite_entity.module, line 175 - Module hooks.
Code
function template_preprocess_bibcite_reference(&$variables) {
$variables['view_mode'] = $variables['elements']['#view_mode'];
$variables['bibcite_reference'] = $variables['elements']['#bibcite_reference'];
$variables += [
'content' => [],
];
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
$variables['attributes']['class'][] = 'bibcite-reference';
}