Skip to content
Snippets Groups Projects
Commit 4fc27645 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-5195: fixing news getting node data

parent 6cfb6522
No related branches found
No related tags found
1 merge request!172Feature/istwcms 5128 ebremner theme node services
......@@ -227,10 +227,12 @@ class UwNodeContent {
$content_data['header']['author'] = $this->addToContentData('author', 'field_author');
}
// Get the hero image.
if ($node_flags['get_hero']) {
$content_data['hero_image'] = $this->addToContentData('sources', 'field_uw_hero_image');
}
// Get the listing image.
if ($node_flags['get_listing_image']) {
$content_data['listing_image'] = $this->addToContentData('sources', 'field_uw_blog_listing_page_image');
}
......@@ -273,10 +275,12 @@ class UwNodeContent {
$content_data['header']['date'] = $this->addToContentData('date', 'field_uw_event_date');
}
// Get hero image.
if ($node_flags['get_hero']) {
$content_data['hero_image'] = $this->addToContentData('sources', 'field_uw_hero_image');
}
// Get listing image.
if ($node_flags['get_listing_image']) {
$content_data['listing_image'] = $this->addToContentData('sources', 'field_uw_event_listing_page_img');
}
......@@ -325,21 +329,39 @@ class UwNodeContent {
*/
public function getNewsContent(array $node_flags): array {
// The list of tags for news.
$tag_list = [
'field_uw_news_tags',
'field_uw_audience',
];
// Get the content data.
$content_data = $this->setupContentData($node_flags);
return [
'title' => $node_flags['get_title'] ? TRUE : NULL,
'url' => TRUE,
'date' => $node_flags['get_header'] ? 'field_uw_news_date' : NULL,
'sources' => $node_flags['get_image'] ? 'field_uw_news_listing_page_image' : NULL,
'hero' => $node_flags['get_image'] ? 'field_uw_hero_image' : NULL,
'content' => $node_flags['get_content'] ? 'field_uw_news_summary' : NULL,
'tags' => $node_flags['get_footer'] ? $tag_list : NULL,
];
// Setup the header content.
if ($node_flags['get_header']) {
$content_data['header']['date'] = $this->addToContentData('date', 'field_uw_news_date');
}
// Get hero image.
if ($node_flags['get_hero']) {
$content_data['hero_image'] = $this->addToContentData('sources', 'field_uw_hero_image');
}
// Get listing image.
if ($node_flags['get_listing_image']) {
$content_data['listing_image'] = $this->addToContentData('sources', 'field_uw_news_listing_page_image');
}
// Setup the actual content.
if ($node_flags['get_content']) {
$content_data['content'] = $this->addToContentData('content', 'field_uw_news_summary');
}
// Get the tags.
$content_data['tags'] = $this->addToContentData(
'terms',
[
'field_uw_news_tags',
'field_uw_audience',
]
);
return $content_data;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment