function template_preprocess_bat_event_add_list in Booking and Availability Management Tools for Drupal 8
Prepares variables for list of available event types templates.
Default template: bat-event-add-list.html.twig.
Parameters
array $variables: An associative array containing:
- content: An array of event types.
File
- modules/
bat_event/ bat_event.module, line 1052 - Manage Events - Events store the EventValue of a Unit over a period of time.
Code
function template_preprocess_bat_event_add_list(&$variables) {
$variables['types'] = [];
if (!empty($variables['content'])) {
foreach ($variables['content'] as $type) {
$variables['types'][$type
->id()] = [
'type' => $type
->id(),
'add_link' => Link::fromTextAndUrl($type
->label(), new Url('entity.bat_event.add_form', [
'event_type' => $type
->id(),
])),
];
}
}
}