View source
<?php
function quickbar_preprocess_quickbar(&$vars) {
$vars['collapsed'] = TRUE;
$vars['wrapper_class'] = '';
$settings = variable_get('quickbar_settings_' . $vars['rid'], array());
if (!empty($settings['sticky'])) {
$vars['wrapper_class'] .= ' sticky';
}
if (!empty($settings['nofollow'])) {
$vars['wrapper_class'] .= ' primary-nofollow';
}
foreach ($vars['tree'] as $depth => $menus) {
foreach ($menus as $href => $links) {
$class = $depth > 0 ? 'collapsed' : '';
if ($depth - intval(empty($links)) > 0 && quickbar_in_active_trail($href)) {
$class = '';
$vars['collapsed'] = FALSE;
}
$id = str_replace('/', '-', $href);
$id = str_replace(array(
'<',
'>',
), '', $id);
if ($depth > 0 && !empty($links)) {
if (!module_exists('menu_item_container') || strpos($href, 'menu-item-container') === FALSE) {
$links['view-all'] = array(
'title' => t('View all'),
'href' => $href,
);
}
}
$vars["tree_{$depth}"][$id] = theme('links', array(
'links' => $links,
'attributes' => array(
'class' => "links clearfix {$class}",
'id' => "quickbar-{$id}",
),
));
}
}
}