Commit 8e3dc772 authored by Riccardo Padovani's avatar Riccardo Padovani

Added function to manage header menu

parent ed30fd02
...@@ -126,11 +126,34 @@ function valencia_preprocess_page( &$vars ) { ...@@ -126,11 +126,34 @@ function valencia_preprocess_page( &$vars ) {
*/ */
function valencia_links__system_main_menu($vars) { function valencia_links__system_main_menu($vars) {
switch ($vars['id']) { switch ($vars['id']) {
case 'header':
return valencia_header_menu($vars);
case 'footer': case 'footer':
return valencia_footer_menu($vars); return valencia_footer_menu($vars);
} }
} }
/**
* Custom links for header menu
* Follows http://design.ubuntu.com/web-style-guide/scaffolding#navigation
*/
function valencia_header_menu($vars) {
// Var with all HTML of the menu
$html = '<ul>';
foreach ($vars['links'] as $key => $link) {
// To print every menu voice only one, see Drupal API
if (is_numeric($key)) {
$link_title = $link['#title'];
$link_href = $link['#href'];
$html .= '<li>' . l($link_title, $link_href, array('html' => 'true')) . '</li>';
}
}
$html .= '</ul>';
return $html;
}
/** /**
* Custom links for footer menu * Custom links for footer menu
* Follows http://design.ubuntu.com/web-style-guide/scaffolding#footer * Follows http://design.ubuntu.com/web-style-guide/scaffolding#footer
......
...@@ -85,9 +85,10 @@ ...@@ -85,9 +85,10 @@
<?php endif; ?> <?php endif; ?>
<header class="banner global" role="banner"> <header class="banner global" role="banner">
<nav class="nav-primary" role="navigation"> <nav class="nav-primary" role="navigation">
<ul> <?php print theme('links__system_main_menu', array(
<li><a href="#">Something</a></li> 'links' => $valencia_menu,
</ul> 'id' => 'header'
));?>
<div class="site-name"> <div class="site-name">
<a class="logo-ubuntuit" href="<?php print $front_page; ?>"> <a class="logo-ubuntuit" href="<?php print $front_page; ?>">
<span>ubuntu-it</span> <span>ubuntu-it</span>
......
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