t('left sidebar'), 'right' => t('right sidebar'), 'content_top' => t('content top'), 'content_bottom' => t('content bottom'), 'header' => t('header'), 'footer' => t('footer') ); } /* Breadcrumb override */ function ubiquity_breadcrumb($breadcrumb) { if (!empty($breadcrumb)) { return ''; } } /* Template variables */ function _phptemplate_variables($hook, $vars = array()) { switch ($hook) { case 'page': // secondary tabs if ($secondary = menu_secondary_local_tasks()) { $output .= "\n"; $vars['tabs2'] = $output; } // current logged-in user global $user; if ($user->uid > 0) { $vars['logged_in'] = TRUE; } else { $vars['logged_in'] = FALSE; } // classes for body element $body_classes = array(); $body_classes[] = ($vars['is_front']) ? 'front' : 'not-front'; $body_classes[] = ($vars['logged_in']) ? 'logged-in' : 'not-logged-in'; if ($vars['node']->type) { $body_classes[] = 'ntype-'. ubiquity_id_safe($vars['node']->type); } $body_classes[] = ($vars['secondary_links']) ? 'withsecondary' : ''; switch (TRUE) { case $vars['sidebar_left'] && $vars['sidebar_right'] : $body_classes[] = 'both-sidebars'; break; case $vars['sidebar_left'] : $body_classes[] = 'sidebar-left'; break; case $vars['sidebar_right'] : $body_classes[] = 'sidebar-right'; break; } // implode with spaces $vars['body_classes'] = implode(' ', $body_classes); // Page title integration if (module_exists('page_title')) { $vars['head_title'] = page_title_page_get_title(); } break; case 'node': // get the currently logged in user global $user; $node_classes = array('node'); if ($vars['sticky']) { $node_classes[] = 'sticky'; } if (!$vars['node']->status) { $node_classes[] = 'node-unpublished'; } $node_classes[] = 'ntype-'. ubiquity_id_safe($vars['node']->type); // implode with spaces $vars['node_classes'] = implode(' ', $node_classes); break; case 'comment': // we load the node object that the current comment is attached to $node = node_load($vars['comment']->nid); // if the author of this comment is equal to the author of the node, we set a variable // then in our theme we can theme this comment differently to stand out $vars['author_comment'] = $vars['comment']->uid == $node->uid ? TRUE : FALSE; break; } return $vars; } /* Converts a string to a suitable html ID attribute. */ function ubiquity_id_safe($string) { if (is_numeric($string{0})) { // if the first character is numeric, add 'n' in front $string = 'n'. $string; } return strtolower(preg_replace('/[^a-zA-Z0-9-]+/', '-', $string)); } /* Menu local task rendering */ function ubiquity_menu_local_tasks() { $output = ''; if ($primary = menu_primary_local_tasks()) { $output .= "\n"; } return $output; } /* ugly hack for generating menu items suitable for sliding doors technique */ function ubiquity_menu_item_link($item, $link_item) { return l("".$item['title']."", $link_item['path'], !empty($item['description']) ? array('title' => $item['description']) : array(), isset($item['query']) ? $item['query'] : NULL, isset($item['fragment']) ? $item['fragment'] : NULL, FALSE, TRUE); } /* Add active class to current menu item links. */ function ubiquity_menu_item($mid, $children = '', $leaf = TRUE) { $item = menu_get_item($mid); // get current menu item if ((drupal_get_normal_path($item['path']) == $_GET['q']) || (drupal_is_front_page() && $item['path'] == '')) { $active_class = ' active'; } else { $active_class = ''; } return '
  • '. menu_item_link($mid) . $children ."
  • \n"; } /* override theme_comment_wrapper to disable #comments div when there are no comments. */ function ubiquity_comment_wrapper($content) { if ($content == '') { return ''; } return theme_comment_wrapper($content); } /* Limit pager to 5 items */ function ubiquity_pager_list($limit, $element = 0, $quantity = 5, $text = '', $parameters = array()) { $quantity = min($quantity, 5); return theme_pager_list($limit, $element, $quantity, $text, $parameters); } /* Custom maintenance page */ function ubiquity_maintenance_page($content, $messages = TRUE, $partial = FALSE) { return _phptemplate_callback('page-maintenance', array('content' => $content, 'messages' => $messages, 'partial' => $partial, 'logo' => $logo)); } /* User login block */ function ubiquity_user_login_block($form) { $form['name']['#size'] = '8'; $form['pass']['#size'] = '8'; return _phptemplate_callback('user-login-block', array('form' => $form)); } /* Simplenews block float hack */ function ubiquity_simplenews_block($block) { $output = theme_simplenews_block($block); $output .= '
    '; return $output; }