diff --git a/src/Service/UwNodeContent.php b/src/Service/UwNodeContent.php index f7f3998216ad1720ba15a660da5e8e9ea60bfcf2..62301dd600155c1bbbb1b77f4d1d6034cebc75c1 100644 --- a/src/Service/UwNodeContent.php +++ b/src/Service/UwNodeContent.php @@ -140,7 +140,8 @@ class UwNodeContent { else { if ($content == 'header') { $node_flags['get_header'] = TRUE; - $node_flags['get_image'] = TRUE; + $node_flags['get_title'] = TRUE; + $node_flags['get_hero'] = TRUE; } if ($content == 'footer') { @@ -485,22 +486,33 @@ class UwNodeContent { */ public function getProfileContent(array $node_flags): array { - $tag_list = [ - 'field_uw_ct_profile_type', - ]; + // Get the content data. + $content_data = $this->setupContentData($node_flags); - return [ - 'title' => $node_flags['get_title'] ? TRUE : NULL, - 'position' => $node_flags['get_header'] ? 'field_uw_ct_profile_title' : NULL, - 'affiliation' => $node_flags['get_header'] ? 'field_uw_ct_profile_affiliation' : NULL, - 'content' => $node_flags['get_content'] ? 'field_uw_profile_summary' : NULL, - 'image' => $node_flags['get_header'] ? 'field_uw_ct_profile_image' : NULL, - 'sources' => $node_flags['get_image'] ? 'field_uw_ct_profile_image' : NULL, - 'tags' => $node_flags['get_footer'] ? $tag_list : NULL, - 'link_profile' => $node_flags['get_footer'] ? 'field_uw_ct_profile_info_link' : NULL, - 'personal_webpage' => $node_flags['get_footer'] ? 'field_uw_ct_profile_link_persona' : NULL, - 'url' => TRUE, - ]; + // Setup the header content. + if ($node_flags['get_header']) { + $content_data['header']['position'] = $this->addToContentData('plain_text', 'field_uw_ct_profile_title'); + } + + // Setup the actual content. + if ($node_flags['get_content']) { + $content_data['content'] = $this->addToContentData('content', 'field_uw_news_summary'); + } + + // Get the footer for the profile. + if ($node_flags['get_footer']) { + $content_data['footer']['links']['has_children'] = TRUE; + $content_data['footer']['links']['profile'] = $this->addToContentData('link', 'field_uw_ct_profile_info_link'); + $content_data['footer']['links']['webpage'] = $this->addToContentData('link', 'field_uw_ct_profile_link_persona'); + $content_data['footer']['tags'] = $this->addToContentData( + 'terms', + [ + 'field_uw_ct_profile_type', + ] + ); + } + + return $content_data; } /**