function template_preprocess_bat_unit in Booking and Availability Management Tools for Drupal 8
Prepares variables for Unit templates.
Default template: bat-unit.html.twig.
Parameters
array $variables: An associative array containing:
- elements: An associative array containing the user information and any
- attributes: HTML attributes for the containing element.
File
- modules/
bat_unit/ bat_unit.module, line 824 - Manage units - Units are things that can be booked for some period of time. (e.g. rooms - but also villas bungalows, cars, drills, you-get-the-idea etc.)
Code
function template_preprocess_bat_unit(array &$variables) {
// Fetch Unit Entity Object.
$unit = $variables['elements']['#bat_unit'];
// Helpful $content variable for templates.
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
}