function template_preprocess_bat_type_group_add_list in Booking and Availability Management Tools for Drupal 8
Prepares variables for list of available type group bundles templates.
Default template: bat-type-group-add-list.html.twig.
Parameters
array $variables: An associative array containing:
- content: An array of type group bundles.
File
- ./
bat.module, line 76 - Contains bat.module..
Code
function template_preprocess_bat_type_group_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_type_group.add_form', [
'type_group_bundle' => $type
->id(),
])),
];
}
}
}