Skip to content
Snippets Groups Projects
Commit 452a3b4d authored by Eric Bremner's avatar Eric Bremner Committed by Eric Bremner
Browse files

ISTWCMS-4704: adding logic for featured images on nodes

parent 57edf56d
No related branches found
No related tags found
1 merge request!112Feature/istwcms 4704 m26lebla ebremner content types
...@@ -114,6 +114,8 @@ class UWService implements UWServiceInterface { ...@@ -114,6 +114,8 @@ class UWService implements UWServiceInterface {
$get_content = FALSE; $get_content = FALSE;
$get_title = TRUE; $get_title = TRUE;
$featured_image = $this->uwGetFeaturedImageContentTypes();
// Setup flags based on teaser content argument. // Setup flags based on teaser content argument.
if ($content == 'all') { if ($content == 'all') {
$get_header = TRUE; $get_header = TRUE;
...@@ -126,7 +128,10 @@ class UWService implements UWServiceInterface { ...@@ -126,7 +128,10 @@ class UWService implements UWServiceInterface {
if ($view_mode == 'full') { if ($view_mode == 'full') {
$get_title = FALSE; $get_title = FALSE;
$get_image = TRUE;
if (in_array($node->getType(), array_keys($featured_image))) {
$get_image = TRUE;
}
} }
} }
else { else {
...@@ -222,7 +227,7 @@ class UWService implements UWServiceInterface { ...@@ -222,7 +227,7 @@ class UWService implements UWServiceInterface {
'title' => $get_title ? TRUE : NULL, 'title' => $get_title ? TRUE : NULL,
'sub_title' => $get_header ? 'field_uw_ct_contact_title' : NULL, 'sub_title' => $get_header ? 'field_uw_ct_contact_title' : NULL,
'affiliation' => $get_header ? 'field_uw_ct_contact_affiliation' : NULL, 'affiliation' => $get_header ? 'field_uw_ct_contact_affiliation' : NULL,
'image' => $get_header ? 'field_uw_ct_contact_image' : NULL, 'image' => $get_image ? 'field_uw_ct_contact_image' : NULL,
'content' => $get_content ? 'layout_builder__layout' : NULL, 'content' => $get_content ? 'layout_builder__layout' : NULL,
'email' => $get_footer ? 'field_uw_ct_contact_email' : NULL, 'email' => $get_footer ? 'field_uw_ct_contact_email' : NULL,
'location' => $get_footer ? 'field_uw_ct_contact_location' : NULL, 'location' => $get_footer ? 'field_uw_ct_contact_location' : NULL,
...@@ -353,6 +358,17 @@ class UWService implements UWServiceInterface { ...@@ -353,6 +358,17 @@ class UWService implements UWServiceInterface {
return $node_data; return $node_data;
} }
/**
* {@inheritDoc}
*/
public function uwGetFeaturedImageContentTypes(): array {
return [
'uw_ct_blog' => 'field_uw_blog_listing_page_image',
'uw_ct_event' => 'field_uw_event_listing_page_img',
'uw_ct_news_item' => 'field_uw_news_listing_page_image',
];
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
......
...@@ -58,6 +58,14 @@ interface UWServiceInterface { ...@@ -58,6 +58,14 @@ interface UWServiceInterface {
*/ */
public function uwGetNodeData(Node $node, string $view_mode, array $content_data): array; public function uwGetNodeData(Node $node, string $view_mode, array $content_data): array;
/**
* Gets content types that have feature images.
*
* @return array
* Array of content types that has featured images.
*/
public function uwGetFeaturedImageContentTypes(): array;
/** /**
* Gets dates from node. * Gets dates from node.
* *
......
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