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
......
...@@ -77,37 +77,38 @@ ...@@ -77,37 +77,38 @@
?> ?>
<?php if ( $logo ) : ?> <?php if ( $logo ) : ?>
<div class="logo"> <div class="logo">
<a class="logo-ubuntu" href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo"> <a class="logo-ubuntu" href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
<img src="<?php print $logo; ?>" width="134" height="96" alt="<?php print t('Home'); ?>"> <img src="<?php print $logo; ?>" width="134" height="96" alt="<?php print t('Home'); ?>">
</a> </a>
</div> </div>
<?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"> ));?>
<a class="logo-ubuntuit" href="<?php print $front_page; ?>"> <div class="site-name">
<span>ubuntu-it</span> <a class="logo-ubuntuit" href="<?php print $front_page; ?>">
</a> <span>ubuntu-it</span>
</div> </a>
</nav> </div>
</header> </nav>
<header class="banner global inverted" role="banner"> </header>
<nav class="nav-primary nav-left" role="navigation"> <header class="banner global inverted" role="banner">
<ul> <nav class="nav-primary nav-left" role="navigation">
<li><a href="#">Somewhere</a></li> <ul>
</ul> <li><a href="#">Somewhere</a></li>
<form action="/search" id="search-form" class="header-search"> </ul>
<input type="search" maxlength="255" name="q" id="edit-keys" class="form-text" placeholder="Cerca&hellip;" value="" /> <form action="/search" id="search-form" class="header-search">
<button type="submit"> <input type="search" maxlength="255" name="q" id="edit-keys" class="form-text" placeholder="Cerca&hellip;" value="" />
<img src="http://assets.ubuntu.com/sites/ubuntu/1044/u/img/search-black.svg" alt="Search" height="28" /> <button type="submit">
</button> <img src="http://assets.ubuntu.com/sites/ubuntu/1044/u/img/search-black.svg" alt="Search" height="28" />
</form> </button>
</nav> </form>
</header> </nav>
</header>
<div class="wrapper"><div id="page"> <div class="wrapper"><div id="page">
......
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