Commit 0ef2cdf7 authored by Riccardo Padovani's avatar Riccardo Padovani

Started to work on footer menu function

parent 42295d27
......@@ -109,6 +109,53 @@ function valencia_preprocess_html( &$variables ) {
//function drupal_add_js($data, $options);
}
/**
* Add our vars to the page
*
*/
function valencia_preprocess_page( &$vars ) {
// Get the entire main menu tree
$main_menu_tree = menu_tree_all_data('main-menu');
// Add the rendered output to footer menu
$vars['valencia_footer_menu'] = menu_tree_output($main_menu_tree);
}
function valencia_links__system_main_menu($vars) {
$html = '<ul>';
$voice_number = 0;
foreach ($vars['links'] as $key => $link) {
if (is_numeric($key)) {
$sub_menu = '';
$link_title = $link['#title'];
// Check for submenu
if (!empty($link['#below'])) {
// Recurse
$sub_menu = theme('links__system_main_menu', array(
'links' => $link['#below'],
));
}
if ($link['#original_link']['depth'] === '1') {
// First level menu is h2
$html .= '<li><h2>' . l($link_title, $link['#href'], array('html' => 'true')) . '</h2>' . $sub_menu . '</li>';
}
else if ($voice_number === 0) {
$html .= '<li class="first">' . l($link_title, $link['#href'], array('html' => 'true')) . $sub_menu . '</li>';
}
else {
$html .= '<li>' . l($link_title, $link['#href'], array('html' => 'true')) . $sub_menu . '</li>';
}
$voice_number++;
}
}
$html .= '</ul>';
return $html;
}
if ( !function_exists( 'region_empty' ) ) :
/**
* Check if region is empty.
......
......@@ -136,7 +136,9 @@
<nav role="navigation">
<div class="footer-a">
<div class="clearfix">
<?php print render($page['footer']); ?>
<?php print theme('links__system_main_menu', array(
'links' => $valencia_footer_menu
));?>
</div> </div> <!-- /.clearfix, /.footer-a -->
<div class="legal clearfix">
<p class="twelve-col">&copy; Ubuntu e Canonical sono marchi registrati da Canonical Ltd.</p>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment