getBodyAttributes(); $classes = $attributes['class']; if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) { $classes[] = 'two-sidebars'; } elseif (!empty($variables['page']['sidebar_first'])) { $classes[] = 'one-sidebar'; $classes[] = 'sidebar-first'; } elseif (!empty($variables['page']['sidebar_second'])) { $classes[] = 'one-sidebar'; $classes[] = 'sidebar-second'; } else { $classes[] = 'no-sidebars'; } if (!empty($variables['page']['featured'])) { $classes[] = 'featured'; } if (!empty($variables['page']['triptych_first']) || !empty($variables['page']['triptych_middle']) || !empty($variables['page']['triptych_last'])) { $classes[] = 'triptych'; } if (!empty($variables['page']['footer_firstcolumn']) || !empty($variables['page']['footer_secondcolumn']) || !empty($variables['page']['footer_thirdcolumn']) || !empty($variables['page']['footer_fourthcolumn'])) { $classes[] = 'footer-columns'; } // Store back the classes to the htmlpage object. $attributes['class'] = $classes; // Pass the main menu and secondary menu to the template as render arrays. if (!empty($variables['main_menu'])) { $variables['main_menu']['#attributes']['id'] = 'main-menu-links'; $variables['main_menu']['#attributes']['class'] = array('links', 'clearfix'); } if (!empty($variables['secondary_menu'])) { $variables['secondary_menu']['#attributes']['id'] = 'secondary-menu-links'; $variables['secondary_menu']['#attributes']['class'] = array('links', 'inline', 'clearfix'); } // Set the options that apply to both page and maintenance page. _bartik_process_page($variables); // Since the title and the shortcut link are both block level elements, // positioning them next to each other is much simpler with a wrapper div. if (!empty($variables['title_suffix']['add_or_remove_shortcut']) && $variables['title']) { // Add a wrapper div using the title_prefix and title_suffix render elements. $variables['title_prefix']['shortcut_wrapper'] = array( '#markup' => '
', '#weight' => 100, ); $variables['title_suffix']['shortcut_wrapper'] = array( '#markup' => '
', '#weight' => -99, ); // Make sure the shortcut link is the first item in title_suffix. $variables['title_suffix']['add_or_remove_shortcut']['#weight'] = -100; } } /** * Implements hook_preprocess_HOOK() for maintenance page templates. */ function bartik_preprocess_maintenance_page(&$variables) { // By default, site_name is set to Drupal if no db connection is available // or during site installation. Setting site_name to an empty string makes // the site and update pages look cleaner. // @see template_preprocess_maintenance_page if (!$variables['db_is_active']) { $variables['site_name'] = ''; } $variables['styles'] = new RenderWrapper('drupal_get_css'); // Normally we could attach libraries via hook_page_alter(), but when the // database is inactive it's not called so we add them here. $libraries = array( '#attached' => array( 'library' => array( 'bartik/maintenance_page', ), ), ); // Set the options that apply to both page and maintenance page. _bartik_process_page($variables); } /** * Implements hook_preprocess_HOOK() for node templates. */ function bartik_preprocess_node(&$variables) { // Remove the "Add new comment" link on teasers or when the comment form is // displayed on the page. if ($variables['teaser'] || !empty($variables['content']['comments']['comment_form'])) { unset($variables['content']['links']['comment']['#links']['comment-add']); } } /** * Implements hook_preprocess_HOOK() for block templates. */ function bartik_preprocess_block(&$variables) { // Add a clearfix class to system branding blocks. if ($variables['plugin_id'] == 'system_branding_block') { $variables['attributes']['class'][] = 'clearfix'; } } /** * Implements theme_menu_tree(). */ function bartik_menu_tree($variables) { return ''; } /** * Implements theme_menu_tree__shortcut_default() { */ function bartik_menu_tree__shortcut_default($variables) { return ''; } /** * Implements theme_field__field_type(). */ function bartik_field__taxonomy_term_reference($variables) { $output = ''; // Render the label either as a visible list or make it visually hidden for accessibility. $hidden_class = empty($variables['label_hidden']) ? '' : ' visually-hidden'; $output .= '

' . $variables['label'] . ':

'; // Render the items. $output .= ($variables['element']['#label_display'] == 'inline') ? '