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 { ...@@ -227,10 +227,12 @@ class UwNodeContent {
$content_data['header']['author'] = $this->addToContentData('author', 'field_author'); $content_data['header']['author'] = $this->addToContentData('author', 'field_author');
} }
// Get the hero image.
if ($node_flags['get_hero']) { if ($node_flags['get_hero']) {
$content_data['hero_image'] = $this->addToContentData('sources', 'field_uw_hero_image'); $content_data['hero_image'] = $this->addToContentData('sources', 'field_uw_hero_image');
} }
// Get the listing image.
if ($node_flags['get_listing_image']) { if ($node_flags['get_listing_image']) {
$content_data['listing_image'] = $this->addToContentData('sources', 'field_uw_blog_listing_page_image'); $content_data['listing_image'] = $this->addToContentData('sources', 'field_uw_blog_listing_page_image');
} }
...@@ -273,10 +275,12 @@ class UwNodeContent { ...@@ -273,10 +275,12 @@ class UwNodeContent {
$content_data['header']['date'] = $this->addToContentData('date', 'field_uw_event_date'); $content_data['header']['date'] = $this->addToContentData('date', 'field_uw_event_date');
} }
// Get hero image.
if ($node_flags['get_hero']) { if ($node_flags['get_hero']) {
$content_data['hero_image'] = $this->addToContentData('sources', 'field_uw_hero_image'); $content_data['hero_image'] = $this->addToContentData('sources', 'field_uw_hero_image');
} }
// Get listing image.
if ($node_flags['get_listing_image']) { if ($node_flags['get_listing_image']) {
$content_data['listing_image'] = $this->addToContentData('sources', 'field_uw_event_listing_page_img'); $content_data['listing_image'] = $this->addToContentData('sources', 'field_uw_event_listing_page_img');
} }
...@@ -325,21 +329,39 @@ class UwNodeContent { ...@@ -325,21 +329,39 @@ class UwNodeContent {
*/ */
public function getNewsContent(array $node_flags): array { public function getNewsContent(array $node_flags): array {
// The list of tags for news. // Get the content data.
$tag_list = [ $content_data = $this->setupContentData($node_flags);
'field_uw_news_tags',
'field_uw_audience',
];
return [ // Setup the header content.
'title' => $node_flags['get_title'] ? TRUE : NULL, if ($node_flags['get_header']) {
'url' => TRUE, $content_data['header']['date'] = $this->addToContentData('date', 'field_uw_news_date');
'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, // Get hero image.
'content' => $node_flags['get_content'] ? 'field_uw_news_summary' : NULL, if ($node_flags['get_hero']) {
'tags' => $node_flags['get_footer'] ? $tag_list : NULL, $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