<?php list($toggler_id, $toggler) = _smash_2013_prep_toggler(print_r($rows, 1)); ?> <?php print $wrapper_prefix; ?> <?php if (!empty($title)) { ?> <h3 class="event-list-title--<?php print preg_replace('/[^a-z0-9-]/', '-', strtolower($title)); ?> "><?php print $title; ?> </h3> <?php } ?> <?php print $toggler; ?> <div class="menu-wrapper" id="<?php print $toggler_id; ?> "> <?php print $list_type_prefix; ?>
/** * Implements theme_menu_tree__menu_block */ function smash2013_menu_tree__menu_block($variables) { $tree = $variables['tree']; list($id, $label) = _smash_2013_prep_toggler($tree); // Load into DOM $doc = new DOMDocument(); @$doc->loadHTML($tree); $el = $doc->getElementsByTagName('body')->item(0); $count = 0; $override_tag = NULL; foreach ($el->childNodes as $node) { if ($node->nodeType != XML_ELEMENT_NODE) { continue; } if (strpos($node->getAttribute('class'), 'menu-item-group') !== FALSE) { $count++; } // check if this is a view and test on that $view_test = _dom_getElementsByClassName($node, 'view-content'); if (count($view_test) > 0) { $count += count(_dom_getElementsByClassName($view_test[0], 'menu-item-group')); $override_tag = 'ul'; } } $count = $count > 0 ? $count : 1; $class = 'menu'; $tag = 'ul'; if ($count > 1) { $class .= ' menu-columns-' . $count; $tag = 'div'; if (!is_null($override_tag)) { $tag = $override_tag; } } return $label . '<div class="menu-wrapper">' . '<' . $tag . ' class="' . $class . '" id=" ' . $id . ' ">' . $tree . '</' . $tag . '>' . '</div>'; }