From 7f6f17fc3b8ecdd5f7b31be26adc17a3eead13b0 Mon Sep 17 00:00:00 2001
From: Eric Bremner <ebremner@uwaterloo.ca>
Date: Fri, 10 Dec 2021 16:58:35 +0000
Subject: [PATCH] ISTWCMS-5214: updating opportunities to send some data to the
 footer when on a teaser

---
 src/Service/UwNodeContent.php | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/Service/UwNodeContent.php b/src/Service/UwNodeContent.php
index 7eb1de98..4186470e 100644
--- a/src/Service/UwNodeContent.php
+++ b/src/Service/UwNodeContent.php
@@ -645,17 +645,18 @@ class UwNodeContent {
     // Setup the header content.
     if ($node_flags['get_header']) {
 
-      if ($view_mode == 'teaser') {
-        $content_data['header']['posted'] = $this->addToContentData('date', 'field_uw_opportunity_date');
-        $content_data['header']['opportunity_type'] = $this->addToContentData('terms', ['field_uw_opportunity_type']);
-      }
-      else {
-        $content_data['header']['opportunity_type'] = $this->addToContentData('terms', ['field_uw_opportunity_type']);
-        $content_data['header']['employment_type'] = $this->addToContentData('terms', ['field_uw_opportunity_employment']);
-        $content_data['header']['rate_of_pay'] = $this->addToContentData('plain_text', 'field_uw_opportunity_pay_rate');
-        $content_data['header']['rate_of_pay_type'] = $this->addToContentData('terms', ['field_uw_opportunity_pay_type']);
-        $content_data['header']['job_id'] = $this->addToContentData('plain_text', 'field_uw_opportunity_job_id');
-      }
+      $content_data['header']['opportunity_type'] = $this->addToContentData('terms', ['field_uw_opportunity_type']);
+      $content_data['header']['employment_type'] = $this->addToContentData('terms', ['field_uw_opportunity_employment']);
+      $content_data['header']['rate_of_pay'] = $this->addToContentData('plain_text', 'field_uw_opportunity_pay_rate');
+      $content_data['header']['rate_of_pay_type'] = $this->addToContentData('terms', ['field_uw_opportunity_pay_type']);
+      $content_data['header']['job_id'] = $this->addToContentData('plain_text', 'field_uw_opportunity_job_id');
+    }
+
+    // If we are on a teaser, send some fields to the footer,
+    // so that the display after the content.
+    if ($view_mode == 'teaser') {
+      $content_data['footer']['posted'] = $this->addToContentData('date', 'field_uw_opportunity_date');
+      $content_data['footer']['opportunity_type'] = $this->addToContentData('terms', ['field_uw_opportunity_type']);
     }
 
     if ($node_flags['get_footer']) {
-- 
GitLab