function template_preprocess_private_message_thread in Private Message 8
Same name and namespace in other branches
- 8.2 private_message.module \template_preprocess_private_message_thread()
Prepares variables for private_message_thread templates.
Default template: private-message-thread.html.twig.
Parameters
array $variables: An associative array containing:
- elements: An array of elements to display in view mode.
- private_message_thread: The private messsage thread object.
- view_mode: View mode; e.g., 'full', 'teaser', etc.
File
- ./
private_message.module, line 515 - Contains hooks for the private message module.
Code
function template_preprocess_private_message_thread(array &$variables) {
$variables['view_mode'] = $variables['elements']['#view_mode'];
// Provide a distinct $teaser boolean.
$variables['private_message_thread'] = $variables['elements']['#private_message_thread'];
$private_message_thread = $variables['private_message_thread'];
$variables['last_update'] = drupal_render($variables['elements']['updated']);
$variables['url'] = $private_message_thread
->url('canonical', [
'language' => $private_message_thread
->language(),
]);
// Helpful $content variable for templates.
$variables += [
'content' => [],
];
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
}