function template_preprocess_content_sync_message in Content Synchronization 8.2
Same name and namespace in other branches
- 8 includes/content_sync.theme.inc \template_preprocess_content_sync_message()
- 3.0.x includes/content_sync.theme.inc \template_preprocess_content_sync_message()
Prepares variables for Content Sync message templates.
Default template: content-sync-message.html.twig.
Parameters
array $variables: An associative array containing:
- element: An associative array containing the properties of the element. Properties used: #id, #attributes, #children.
See also
template_preprocess_container()
File
- includes/
content_sync.theme.inc, line 70 - Preprocessors and helper functions to make theming easier.
Code
function template_preprocess_content_sync_message(array &$variables) {
$variables['has_parent'] = FALSE;
$element = $variables['element'];
// Ensure #attributes is set.
$element += [
'#attributes' => [],
];
// Special handling for content_sync elements.
if (isset($element['#array_parents'])) {
// Assign an html ID.
if (!isset($element['#attributes']['id'])) {
$element['#attributes']['id'] = $element['#id'];
}
$variables['has_parent'] = TRUE;
}
$variables['message'] = $element['#message'];
$variables['attributes'] = $element['#attributes'];
if (isset($element['#closed'])) {
$variables['closed'] = $element['#closed'];
}
}