array('links', 'main-menu'), 'id' => array('primary'), ) ); } else { $vars['primary_nav'] = FALSE; } if (isset($vars['secondary_menu'])) { $vars['secondary_menu'] = theme('links', $vars['secondary_menu'], array( 'class' => array('links', 'sub-menu'), 'id' => array('secondary'), ) ); } else { $vars['secondary_menu'] = FALSE; } // Adding a class to body in wireframe mode if (theme_get_setting('wireframe_mode')) { $vars['classes_array'][] = 'wireframe-mode'; } if (!empty($vars['main_menu']) or !empty($vars['sub_menu'])) { $vars['classes_array'][] = 'with-navigation'; } // Add PAGE template suggestions based on content type if (!empty($vars['node']->type)) { $vars['template_files'][] = "page-type-" . $vars['node']->type; } if (!empty($vars['node']->nid)) { $vars['template_files'][] = "page-node-" . $vars['node']->nid; } } function basic_preprocess_node(&$vars) { // Add a striping class. $vars['classes_array'][] = 'node-' . $vars['zebra']; } function basic_preprocess_block(&$vars, $hook) { $block = $vars['block']; if (theme_get_setting('block_editing')) { // Display 'edit block' for custom blocks. if ($block->module == 'block') { $edit_links[] = l('' . t('edit block') . '', 'admin/structure/block/configure/' . $block->module . '/' . $block->delta, array( 'attributes' => array( 'title' => t('edit the content of this block'), 'class' => 'block-edit', ), 'query' => drupal_get_destination(), 'html' => TRUE, ) ); } // Display 'configure' for other blocks. else { $edit_links[] = l('' . t('configure') . '', 'admin/structure/block/configure/' . $block->module . '/' . $block->delta, array( 'attributes' => array( 'title' => t('configure this block'), 'class' => 'block-config', ), 'query' => drupal_get_destination(), 'html' => TRUE, ) ); } // Display 'edit menu' for Menu blocks. if (($block->module == 'menu' || ($block->module == 'user' && $block->delta == 1)) && user_access('administer menu')) { $menu_name = ($block->module == 'user') ? 'navigation' : $block->delta; $edit_links[] = l('' . t('edit menu') . '', 'admin/structure/menu-customize/' . $menu_name, array( 'attributes' => array( 'title' => t('edit the menu that defines this block'), 'class' => 'block-edit-menu', ), 'query' => drupal_get_destination(), 'html' => TRUE, ) ); } // Display 'edit menu' for Menu block blocks. elseif ($block->module == 'menu_block' && user_access('administer menu')) { list($menu_name, ) = split(':', variable_get("menu_block_{$block->delta}_parent", 'navigation:0')); $edit_links[] = l('' . t('edit menu') . '', 'admin/structure/menu-customize/' . $menu_name, array( 'attributes' => array( 'title' => t('edit the menu that defines this block'), 'class' => 'block-edit-menu', ), 'query' => drupal_get_destination(), 'html' => TRUE, ) ); } $vars['edit_links_array'] = $edit_links; $vars['edit_links'] = '
' . implode(' ', $edit_links) . '
'; } } /* * Add custom classes to menu item */ function basic_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) { $class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf')); if (!empty($extra_class)) { $class .= ' '. $extra_class; } if ($in_active_trail) { $class .= ' active-trail'; } // New line added to get unique classes for each menu item $css_class = basic_id_safe(str_replace(' ', '_', strip_tags($link))); return '
  • ' . $link . $menu ."
  • \n"; } /* * Customize the PRIMARY and SECONDARY LINKS, to allow the admin tabs to work on all browsers * An implementation of theme_menu_item_link() * * @param $link * array The menu item to render. * @return * string The rendered menu item. */ function basic_menu_item_link($link) { if (empty($link['localized_options'])) { $link['localized_options'] = array(); } // If an item is a LOCAL TASK, render it as a tab if ($link['type'] & MENU_IS_LOCAL_TASK) { $link['title'] = '' . check_plain($link['title']) . ''; $link['localized_options']['html'] = TRUE; } return l($link['title'], $link['href'], $link['localized_options']); } /* * Duplicate of theme_menu_local_tasks() but adds clearfix to tabs. */ function basic_menu_local_tasks() { $output = ''; if ($primary = menu_primary_local_tasks()) { if(menu_secondary_local_tasks()) { $output .= ''; } else { $output .= ''; } } if ($secondary = menu_secondary_local_tasks()) { $output .= ''; } return $output; } /* * Converts a string to a suitable html ID attribute. * * http://www.w3.org/TR/html4/struct/global.html#h-7.5.2 specifies what makes a * valid ID attribute in HTML. This function: * * - Ensure an ID starts with an alpha character by optionally adding an 'n'. * - Replaces any character except A-Z, numbers, and underscores with dashes. * - Converts entire string to lowercase. * * @param $string * The string * @return * The converted string */ function basic_id_safe($string) { // Replace with dashes anything that isn't A-Z, numbers, dashes, or underscores. $string = strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '-', $string)); // If the first character is not a-z, add 'n' in front. if (!ctype_lower($string{0})) { // Don't use ctype_alpha since its locale aware. $string = 'id'. $string; } return $string; } /* * Return a themed breadcrumb trail. * Alow you to customize the breadcrumb markup */ function basic_breadcrumb($breadcrumb) { if (!empty($breadcrumb)) { return ''; } }