function template_preprocess_message_add_list in Message UI 8
Prepares variables for list of available message templates.
Default template: message-add-list.html.twig.
Parameters
array $variables: An associative array containing:
- content: An array of message templates.
See also
message_add_page()
File
- ./
message_ui.module, line 138 - Contains Drupal\message_ui\message_ui.module.
Code
function template_preprocess_message_add_list(array &$variables) {
$variables['templates'] = [];
if (!empty($variables['content'])) {
foreach ($variables['content'] as $template) {
$variables['templates'][$template
->id()] = [
'template' => $template
->id(),
'add_link' => Link::fromTextAndUrl($template
->label(), new Url('message_ui.add', [
'message_template' => $template
->id(),
])),
'description' => [
'#markup' => $template
->getDescription(),
],
];
}
}
}