Commit 1e2100c7 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-4619: updating preprocess node to use refactored teaser content/data

parent d7ccc7f7
......@@ -42,35 +42,8 @@ function uw_ct_event_preprocess_node(&$variables) {
// The UW service object.
$uwService = \Drupal::service('uw_cfg_common.uw_service');
// Get the image entity.
$image = $variables['node']->field_uw_event_listing_page_img->entity;
// If there is an image, get the responsive image sources.
if ($image) {
$sources = $uwService->prepareResponsiveImage($image, 'uw_ris_media');
}
else {
$sources = NULL;
}
// Get the header and footer data from the UW service.
$header_data = $uwService->uwGetHeaderData($variables['node']);
$footer_data = $uwService->uwGetFooterData($variables['node']);
// Set the variables that we can use in the template.
$variables['teaser'] = [
'date' => $header_data['date'],
'title' => $header_data['title'],
'sources' => $sources !== NULL ? $sources['sources'] : '',
'img_element' => $sources !== NULL ? $sources['img_element']['#uri'] : NULL,
'tags' => $footer_data !== NULL ? $footer_data['tags'] : NULL,
'content' => [
'#type' => 'processed_text',
'#text' => $variables['node']->field_uw_event_summary->value,
'#format' => $variables['node']->field_uw_event_summary->format,
],
'header_level' => 2,
];
// Get the teaser variables.
$variables['teaser'] = $uwService->getTeaserContent($variables['node'], 'events', 'all');
// Unset the content variable, so that we do not get
// a second print of all the content.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment