/** * Implements hook_preprocess_page(). */ function techoregon_preprocess_page(&$variables) { // If front page, change logo if ($variables['is_front']) { $variables['logo'] = path_to_theme() . '/images/logos/Logo_white_text.png'; } // Remove .navbar-default class from header navbar to avoid unwanted styling if (($key = array_search('navbar-default', $variables['navbar_classes_array'])) !== false) { unset($variables['navbar_classes_array'][$key]); } // If there is a value for hero text or hero image field, then we can assume // there is also a hero text/image view and default page title should not be rendered if (!empty($variables['node']->field_hero_text) || !empty($variables['node']->field_hero_image)) { $variables['title'] = ''; } // Add classes to body based on site section or content type if (!empty($variables['node']->field_site_section)) { switch ($variables['node']->field_site_section['und'][0]['tid']) { // Get Involved case "8": ctools_class_add('section-involved'); break; // What We Do // What We Do case "7": ctools_class_add('section-do'); break; // Who We Are // Who We Are case "6": ctools_class_add('section-are'); break; // Events // Events case "34": ctools_class_add('section-events'); break; // Blog // Blog case "31": ctools_class_add('section-blog'); break; } } if (!empty($variables['node']->type)) { switch ($variables['node']->type) { case "blog": ctools_class_add('section-blog'); break; case "event": ctools_class_add('section-events'); break; } } // If page is landing page content type, add class to body if (!empty($variables['node']->type) && $variables['node']->type == 'landing_page') { ctools_class_add('landing-page'); } }
/** * Implements hook_preprocess_page(). */ function europa_preprocess_page(&$variables) { // Small fix to maxe the link to the start page use the alias with language. $variables['front_page'] = url('<front>'); // Add information about the number of sidebars. if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) { $variables['content_column_class'] = 'col-md-6'; } elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) { $variables['content_column_class'] = 'col-md-9'; } else { $variables['content_column_class'] = 'col-md-12'; } // Set footer region column classes. if (!empty($variables['page']['footer_right'])) { $variables['footer_column_class'] = 'col-sm-8'; } else { $variables['footer_column_class'] = 'col-sm-12'; } $variables['page_logo_title'] = t('Home - @sitename', array('@sitename' => variable_get('site_name', 'European Commission'))); $node =& $variables['node']; if (isset($node)) { // Adding generic introduction field to be later rendered in page template. $variables['field_core_introduction'] = isset($node->field_core_introduction) ? field_view_field('node', $node, 'field_core_introduction', array('label' => 'hidden')) : NULL; // Check if Display Suite is handling node. if (module_exists('ds')) { $layout = ds_get_layout('node', $node->type, 'full'); if ($layout && isset($layout['is_nexteuropa']) && $layout['is_nexteuropa'] == TRUE) { // If our display suite layout has a header region. if (isset($layout['regions']['left_header'])) { // Move the header_bottom to the node. $variables['node']->header_bottom = $variables['page']['header_bottom']; unset($variables['page']['header_bottom']); } ctools_class_add($layout['layout']); if (isset($node->ds_switch) && $node->ds_switch != 'college') { $variables['node']->header_bottom_modifier = 'page-bottom-header--full-grey'; } // This disables message-printing on ALL page displays. $variables['show_messages'] = FALSE; // Add tabs to node object so we can put it in the DS template instead. if (isset($variables['tabs'])) { $node->local_tabs = drupal_render($variables['tabs']); } $variables['theme_hook_suggestions'][] = 'page__ds_node'; } } } }