diff --git a/src/Service/UwNodeContent.php b/src/Service/UwNodeContent.php index dd38d8dbbc0adc826ea4182c6fad953a2f556c83..8d94a4108d7eb5bbdd0f3d786a063c4369bb9bf6 100644 --- a/src/Service/UwNodeContent.php +++ b/src/Service/UwNodeContent.php @@ -437,22 +437,47 @@ class UwNodeContent { */ public function getContactContent(array $node_flags): array { - return [ - 'title' => $node_flags['get_title'] ? TRUE : NULL, - 'position' => $node_flags['get_header'] ? 'field_uw_ct_contact_title' : NULL, - 'affiliation' => $node_flags['get_header'] ? 'field_uw_ct_contact_affiliation' : NULL, - 'image' => $node_flags['get_image'] ? 'field_uw_ct_contact_image' : NULL, - 'content' => $node_flags['get_content'] ? 'layout_builder__layout' : NULL, - 'email' => $node_flags['get_footer'] ? 'field_uw_ct_contact_email' : NULL, - 'location' => $node_flags['get_footer'] ? 'field_uw_ct_contact_location' : NULL, - 'phone' => $node_flags['get_footer'] ? 'field_uw_ct_contact_phone' : NULL, - 'additional_info' => $node_flags['get_footer'] ? 'field_uw_ct_contact_info' : NULL, - 'link_profile' => $node_flags['get_footer'] ? 'field_uw_ct_contact_link_profile' : NULL, - 'personal_webpage' => $node_flags['get_footer'] ? 'field_uw_ct_contact_link_persona' : NULL, - 'contact_for' => $node_flags['get_footer'] ? 'field_uw_ct_contact_contact_for' : NULL, - 'groups' => $node_flags['get_footer'] ? 'field_uw_ct_contact_group' : NULL, - 'url' => TRUE, - ]; + // Get the content data. + $content_data = $this->setupContentData($node_flags); + + // Setup the header content. + if ($node_flags['get_header']) { + $content_data['header']['position'] = $this->addToContentData('plain_text', 'field_uw_ct_contact_title'); + } + + // Setup the actual content. + if ($node_flags['get_content']) { + $content_data['content'] = $this->addToContentData('content', 'field_uw_news_summary'); + } + + // Get the footer data. + if ($node_flags['get_footer']) { + + // Get the additional info. + $content_data['footer']['additional_info']['has_children'] = TRUE; + $content_data['footer']['additional_info']['info'] = $this->addToContentData('formatted_text', 'field_uw_ct_contact_info'); + + // Get the contact information. + $content_data['footer']['contact_info']['has_children'] = TRUE; + $content_data['footer']['contact_info']['email'] = $this->addToContentData('plain_text', 'field_uw_ct_contact_email'); + $content_data['footer']['contact_info']['phone'] = $this->addToContentData('plain_text', 'field_uw_ct_contact_phone'); + $content_data['footer']['contact_info']['location'] = $this->addToContentData('plain_text', 'field_uw_ct_contact_location', 'Location'); + + // Get the links for the profile. + $content_data['footer']['links']['has_children'] = TRUE; + $content_data['footer']['links']['profile'] = $this->addToContentData('link', 'field_uw_ct_contact_link_profile', 'Link to profile'); + $content_data['footer']['links']['webpage'] = $this->addToContentData('link', 'field_uw_ct_contact_link_persona', 'Link to personal webpage'); + + // Get the contact for, for the profile. + $content_data['footer']['contact_for']['has_children'] = TRUE; + $content_data['footer']['contact_for']['contact'] = $this->addToContentData('plain_text', 'field_uw_ct_contact_contact_for'); + + // Get the groups for the profile. + $content_data['footer']['groups']['has_children'] = TRUE; + $content_data['footer']['groups']['groups'] = $this->addToContentData('terms', ['field_uw_ct_contact_group']); + } + + return $content_data; } /**