'links main-menu'));
$vars['secondary_menu_links'] = theme('links', $vars['secondary_menu'], array('class' => 'links secondary-menu'));
// Adding a class to body in wireframe mode
if (theme_get_setting('wireframe_mode')) {
$vars['classes_array'][] = 'wireframe-mode';
}
// 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_block(&$vars, $hook) {
$block = $vars['block'];
if (theme_get_setting('block_editing') && user_access('administer blocks')) {
// 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['options'])) {
$link['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['options']['html'] = TRUE;
}
if (empty($link['type'])) {
$true = TRUE;
}
return l($link['title'], $link['href'], $link['options']);
}
//
// Duplicate of theme_menu_local_tasks() but adds clearfix to tabs.
//
function basic_menu_local_tasks() {
$output = '';
if ($primary = menu_primary_local_tasks()) {
$output .= "\n";
}
if ($secondary = menu_secondary_local_tasks()) {
$output .= "\n";
}
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 ''. implode(' ยป ', $breadcrumb) .'
';
}
}