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 ) {
*/
function valencia_links__system_main_menu($vars) {
switch ($vars['id']) {
case 'header':
return valencia_header_menu($vars);
case 'footer':
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
* Follows http://design.ubuntu.com/web-style-guide/scaffolding#footer
......
......@@ -77,37 +77,38 @@
?>
<?php if ( $logo ) : ?>
<div class="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'); ?>">
</a>
</div>
<div class="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'); ?>">
</a>
</div>
<?php endif; ?>
<header class="banner global" role="banner">
<nav class="nav-primary" role="navigation">
<ul>
<li><a href="#">Something</a></li>
</ul>
<div class="site-name">
<a class="logo-ubuntuit" href="<?php print $front_page; ?>">
<span>ubuntu-it</span>
</a>
</div>
</nav>
</header>
<header class="banner global inverted" role="banner">
<nav class="nav-primary nav-left" role="navigation">
<ul>
<li><a href="#">Somewhere</a></li>
</ul>
<form action="/search" id="search-form" class="header-search">
<input type="search" maxlength="255" name="q" id="edit-keys" class="form-text" placeholder="Cerca&hellip;" value="" />
<button type="submit">
<img src="http://assets.ubuntu.com/sites/ubuntu/1044/u/img/search-black.svg" alt="Search" height="28" />
</button>
</form>
</nav>
</header>
<header class="banner global" role="banner">
<nav class="nav-primary" role="navigation">
<?php print theme('links__system_main_menu', array(
'links' => $valencia_menu,
'id' => 'header'
));?>
<div class="site-name">
<a class="logo-ubuntuit" href="<?php print $front_page; ?>">
<span>ubuntu-it</span>
</a>
</div>
</nav>
</header>
<header class="banner global inverted" role="banner">
<nav class="nav-primary nav-left" role="navigation">
<ul>
<li><a href="#">Somewhere</a></li>
</ul>
<form action="/search" id="search-form" class="header-search">
<input type="search" maxlength="255" name="q" id="edit-keys" class="form-text" placeholder="Cerca&hellip;" value="" />
<button type="submit">
<img src="http://assets.ubuntu.com/sites/ubuntu/1044/u/img/search-black.svg" alt="Search" height="28" />
</button>
</form>
</nav>
</header>
<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