You are here

function template_preprocess_bat_unit_type in Booking and Availability Management Tools for Drupal 8

Prepares variables for Unit Type templates.

Default template: bat-unit-type.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 844
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_type(array &$variables) {

  // Fetch Unit Entity Object.
  $unit = $variables['elements']['#bat_unit_type'];

  // Helpful $content variable for templates.
  foreach (Element::children($variables['elements']) as $key) {
    $variables['content'][$key] = $variables['elements'][$key];
  }
}