array( // function that renders classic primary menu with

'variables' => array('links' => NULL, 'attributes' => NULL, 'heading' => NULL), ), 'mega_menu' => array( 'variables' => array('menu' => NULL), ), 'mbanner_text' => array( // 'variables' => array('text' => NULL), ), 'mbanner_nav' => array( 'variables' => array('prev' => NULL, 'next' => NULL), ), ); } /** * Custom primary menu with

for each item */ function marinelli_custom_links($variables) { global $language_url; $links = $variables['links']; $attributes = $variables['attributes']; $heading = $variables['heading']; $output = ''; if (count($links) > 0) { $output = ''; // Treat the heading first if it is present to prepend it to the // list of links. if (!empty($heading)) { if (is_string($heading)) { // Prepare the array that will be used when the passed heading // is a string. $heading = array( 'text' => $heading, // Set the default level of the heading. 'level' => 'h2', ); } $output .= '<' . $heading['level']; if (!empty($heading['class'])) { $output .= drupal_attributes(array('class' => $heading['class'])); } $output .= '>' . check_plain($heading['text']) . ''; } $output .= ''; $num_links = count($links); $i = 1; foreach ($links as $key => $link) { $class = array($key); // Add first, last and active classes to the list of links to help out themers. if ($i == 1) { $class[] = 'first'; } if ($i == $num_links) { $class[] = 'last'; } if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '' && drupal_is_front_page())) && (empty($link['language']) || $link['language']->language == $language_url->language)) { $class[] = 'active'; } $output .= ' $class)) . '>

'; if (isset($link['href'])) { // Pass in $link as $options, they share the same keys. $output .= l($link['title'], $link['href'], $link); } elseif (!empty($link['title'])) { // Some links are actually not links, but we wrap these in for adding title and class attributes. if (empty($link['html'])) { $link['title'] = check_plain($link['title']); } $span_attributes = ''; if (isset($link['attributes'])) { $span_attributes = drupal_attributes($link['attributes']); } $output .= '' . $link['title'] . ''; } $i++; $output .= "

\n"; } $output .= ''; } return $output; } /** * Mega drop down primary links. * * param $menu * Full array of main menu * * return string * Html with mega menu to printo into page */ function marinelli_mega_menu($variables) { drupal_add_js(path_to_theme() . '/js/hoverintent/hoverintent.js'); drupal_add_js(path_to_theme() . '/js/menu/marinelli_menu.js'); $menu = $variables['menu']; $alt = theme_get_setting('menu_alt_class'); $output = '
    '; // open list $count_main_links = 1; foreach ($menu as $key => $value) { if ($value['link']['hidden'] != 1) { // check if the link is hidden $id = 'menu-main-title-' . $value['link']['mlid']; // give an unique id for better styling $options = array(); if (isset($value['link']['options']['attributes']['title'])) { $options = array('attributes' => array('title' => $value['link']['options']['attributes']['title'])); } if (theme_get_setting('menu_headings') == 1) { // first level markup (li or h2) $output .= '
  • ' . l($value['link']['link_title'], $value['link']['href'], $options); } elseif (theme_get_setting('menu_headings') == 2) { // use

    , according to http://drupal.org/node/561750 $output .= '
  • ' . l($value['link']['link_title'], $value['link']['href'], $options) . '

    '; } $class = ""; $altclass = ""; if (in_array($count_main_links, $alt)) { // add the alt class based on theme settings $altclass = " alt"; } switch (count($value['below'])) { // choose mega class (div width based on the numbers of columns) case 1: $class = 'one-col' . $altclass; break; case 2: $class = 'two-col' . $altclass; break; case 3: $class = 'three-col' . $altclass; break; case 4: $class = 'four-col' . $altclass; break; case 5: $class = 'five-col' . $altclass; break; case 6: $class = 'six-col' . $altclass; break; } if (count($value['below']) > 0 ) { // check if we have children $output .= '
    '; // open div mega $output .= '
    '; // open div megamenuWrapper foreach ($value['below'] as $key2 => $value2) { if ($value2['below']) { $output .= ''; // close
    menu-section } } // end second foreach $output .= '
    '; // close
    megamenuWrapper $output .= '
    ' . t('close this panel') . '
    '; $output .= '
    '; // close
    mega } // end check for children $output .= '
  • '; // close first level
  • $count_main_links++; } // end check if link is hidden } //end first foreach $output .= '
'; // close first level
    return $output; } function marinelli_mbanner_text() { $banner_text = '
    '; $banner_text .= '
    '; $banner_text .= '<'.OUTTAG.' id="header-image-title">title'; $banner_text .= '

    description

    '; $banner_text .= '
    '; $banner_text .= '
    '; return $banner_text; } function marinelli_mbanner_nav($variables) { $banner_navigation = '
    '; $banner_navigation .= ''; $banner_navigation .= ''; $banner_navigation .= '
    '; return $banner_navigation; }