diff --git a/uw_fdsu_theme_resp.theme b/uw_fdsu_theme_resp.theme index f8f9b3f56b7b0f6bbd6c98755e9328e3d1192be4..0c6e727fa5f13c3c8dedd8555b3eff25d5411b4d 100644 --- a/uw_fdsu_theme_resp.theme +++ b/uw_fdsu_theme_resp.theme @@ -397,22 +397,39 @@ function uw_fdsu_theme_resp_preprocess_container(&$variables) { // Ensure that we are on a layout page. if (\Drupal::routeMatch()->getRouteName() == 'layout_builder.overrides.node.view') { - // The UW service object. - $uwService = \Drupal::service('uw_cfg_common.uw_service'); - // Ensure that we are on the first layout builder container. if ( isset($variables['attributes']['class']) && $variables['attributes']['class'][0] == 'layout-builder' ) { + // The list of content types that will have header + // and footer in layout builder pages. + $content_types = [ + 'uw_ct_blog', + 'uw_ct_news_item', + 'uw_ct_event', + ]; + // Get the node object. $node = \Drupal::routeMatch()->getParameter('node'); - // 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'); + // If there is a node object, and it is a content + // type that has header and footer for layout pages, + // get the header and footer. + if ($node && in_array($node->getType(), $content_types)) { + + // The UW service object. + $uwService = \Drupal::service('uw_cfg_common.uw_service'); + + // Get the node object. + $node = \Drupal::routeMatch()->getParameter('node'); + + // 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'); + } } } }