diff --git a/uw_cfg_common.module b/uw_cfg_common.module index 1d273c3c757e1e3c04b6a492bea80afd4cada900..f62c18c123c6335c43a1cb9cb855b91cd66677a4 100644 --- a/uw_cfg_common.module +++ b/uw_cfg_common.module @@ -207,6 +207,32 @@ function uw_cfg_common_preprocess_node(&$variables) { // an array to future proof, if there are more pages later. $paths_for_content_moderation = ['latest']; + // ISTWCMS-4493: adding class if section has full width. + // If there is a sidebar on the node, check all sections for full width. + if (isset($variables['sidebar'])) { + + // Get the layouts from the node. + $layouts = $variables['node']->layout_builder__layout->getValue(); + + // Step through each of the layouts and check for full width. + foreach ($layouts as $layout) { + + // Get the layout settings from the section. + $settings = $layout['section']->getLayoutSettings(); + + // If the layout builder style is set to full width, then set + // the classes variable for the node and exit the loop. + if ($settings['layout_builder_styles_style'] == "uw_lbs_full_width") { + + // Add a class to the node for full width on a section. + $variables['attributes']['class'][] = 'uw-section-has-full-width'; + + // Break out of the loop to save computational time. + break; + } + } + } + // Check if we are to add the content moderation place. if (in_array(end($path), $paths_for_content_moderation)) {