Skip to content
Snippets Groups Projects
Commit 1ffb2548 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-5204: fixing contacts theming

parent ce5b1796
No related branches found
No related tags found
1 merge request!179ISTWCMS-5204: fixing contacts theming
......@@ -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.
......
......@@ -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') {
......
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