From b629ebc233aa03503a7e0f1bbddd8ecdb494c048 Mon Sep 17 00:00:00 2001 From: Eric Bremner <ebremner@uwaterloo.ca> Date: Tue, 9 Nov 2021 18:09:15 +0000 Subject: [PATCH] ISTWCMS-5195: updating .theme to use new services for getting out node data --- uw_fdsu_theme_resp.theme | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/uw_fdsu_theme_resp.theme b/uw_fdsu_theme_resp.theme index 2a553dcc..3a954422 100644 --- a/uw_fdsu_theme_resp.theme +++ b/uw_fdsu_theme_resp.theme @@ -350,6 +350,8 @@ function uw_fdsu_theme_resp_preprocess_node(&$variables) { // The UW service object. $uwService = \Drupal::service('uw_cfg_common.uw_service'); + $nodeContent = \Drupal::service('uw_cfg_common.uw_node_content'); + // The types of nodes the need preprocessing. $nodes_to_preprocess = $uwService->uwGetNodePreprocessing('full'); @@ -361,19 +363,16 @@ function uw_fdsu_theme_resp_preprocess_node(&$variables) { if (in_array($variables['node']->getType(), $nodes_to_preprocess) || in_array($variables['node']->getType(), $teasers_to_preprocess)) { - // The UW service object. - $uwService = \Drupal::service('uw_cfg_common.uw_service'); - // If on a teaser page get the variables for teaser. if ($variables['view_mode'] == 'teaser' && in_array($variables['node']->getType(), $teasers_to_preprocess)) { - $variables['teaser'] = $uwService->uwGetNodeContent($variables['node'], 'teaser', 'all'); + $variables['teaser'] = $nodeContent->getNodeContent($variables['node'], 'teaser', 'all', $uwService->uwGetNodePreprocessing('featured_image')); } // If on a node page get the variables for now. if ($variables['view_mode'] == 'full' && in_array($variables['node']->getType(), $nodes_to_preprocess)) { - $variables['node_data'] = $uwService->uwGetNodeContent($variables['node'], 'full', 'all'); + $variables['node_data'] = $nodeContent->getNodeContent($variables['node'], 'full', 'all', $uwService->uwGetNodePreprocessing('featured_image')); $variables['node_data']['content'] = $variables['content']; $variables['featured_image'] = $uwService->uwCheckNodeForFeaturedImage($variables['node']); } @@ -489,6 +488,9 @@ function uw_fdsu_theme_resp_preprocess_container(&$variables) { // The UW service object. $uwService = \Drupal::service('uw_cfg_common.uw_service'); + // The UW node content service. + $uwNodeContent = \Drupal::service('uw_cfg_common.uw_node_content'); + // The list of content types that will have header // and footer in layout builder pages. $content_types = $uwService->uwGetNodePreprocessing('layout_container'); @@ -510,8 +512,8 @@ function uw_fdsu_theme_resp_preprocess_container(&$variables) { // If there is a node object, get the header and footer data. if ($node) { - $variables['header_data'] = $uwService->uwGetNodeContent($node, 'teaser', 'header'); - $variables['footer_data'] = $uwService->uwGetNodeContent($node, 'teaser', 'footer'); + $variables['header_data'] = $uwNodeContent->getNodeContent($node, 'teaser', 'header', $uwService->uwGetNodePreprocessing('featured_image')); + $variables['footer_data'] = $uwNodeContent->getNodeContent($node, 'teaser', 'footer', $uwService->uwGetNodePreprocessing('featured_image')); } } } -- GitLab