diff --git a/src/Service/UwNodeContent.php b/src/Service/UwNodeContent.php index 934ef7e25bdf69fddf7523d2be94650e4668a3ab..29210f91dffe86a50fda3ea22b66fb6b48fb08fb 100644 --- a/src/Service/UwNodeContent.php +++ b/src/Service/UwNodeContent.php @@ -139,7 +139,9 @@ class UwNodeContent { $node_flags['get_hero'] = TRUE; } elseif ($view_mode == 'teaser') { - $node_flags['get_footer'] = FALSE; + if ($node->getType() !== 'uw_ct_contact') { + $node_flags['get_footer'] = FALSE; + } $node_flags['get_listing_image'] = TRUE; $node_flags['get_title'] = TRUE; } @@ -453,7 +455,7 @@ class UwNodeContent { // Setup the actual content. if ($node_flags['get_content']) { - $content_data['content'] = $this->addToContentData('content', 'field_uw_news_summary'); + $content_data['content'] = $this->addToContentData('content', NULL); } // Get the footer data. diff --git a/src/Service/UwNodeFieldValue.php b/src/Service/UwNodeFieldValue.php index 794ac06d6b552e31d8153bb772f3d07dccebd249..617ec10c640a13b9464ff48579b729f4b5c4b9cb 100644 --- a/src/Service/UwNodeFieldValue.php +++ b/src/Service/UwNodeFieldValue.php @@ -180,25 +180,29 @@ class UwNodeFieldValue { * * @param \Drupal\node\Entity\Node $node * The node. - * @param string $field_name + * @param string|null $field_name * The name of the field to get. * * @return array * Render array for formatted text. */ - public function getFormattedText(Node $node, string $field_name): array { - - // Get the value of the field. - $value = $node->$field_name->value; - - // If the value is not null, then return the - // formatted text render array. - if ($value !== NULL) { - return [ - '#type' => 'processed_text', - '#text' => $value, - '#format' => $node->$field_name->format, - ]; + public function getFormattedText(Node $node, string $field_name = NULL): array { + + // Ensure that we have a field to check. + if ($field_name !== NULL) { + + // Get the value of the field. + $value = $node->$field_name->value; + + // If the value is not null, then return the + // formatted text render array. + if ($value !== NULL) { + return [ + '#type' => 'processed_text', + '#text' => $value, + '#format' => $node->$field_name->format, + ]; + } } // If we get here there is no value, so @@ -371,13 +375,13 @@ class UwNodeFieldValue { * The node. * @param string $view_mode * The view mode. - * @param string $field_name + * @param string|null $field_name * The field name. * * @return array|null * Array of field value or NULL. */ - public function getContentField(Node $node, string $view_mode, string $field_name) { + public function getContentField(Node $node, string $view_mode, string $field_name = NULL): ?array { // If on the teaser, return the summary field values. if ($view_mode == 'teaser') {