Commit f1129685 authored by Riccardo Padovani's avatar Riccardo Padovani

Remove breadcrumb from news pages

parent a05cae62
...@@ -286,65 +286,67 @@ function valencia_subheader_menu($vars) { ...@@ -286,65 +286,67 @@ function valencia_subheader_menu($vars) {
* Also, if there is, we print third level menu * Also, if there is, we print third level menu
*/ */
function valencia_breadcrumb_menu($vars) { function valencia_breadcrumb_menu($vars) {
// Var with all HTML // Var with all HTML
$html = ''; $html = '';
foreach ($vars['links'] as $key => $link) { foreach ($vars['links'] as $key => $link) {
// See Drupal API, is to print every menu voice only one // See Drupal API, is to print every menu voice only one
if (is_numeric($key)) { if (is_numeric($key)) {
// We need only active links // We need only active links, and we don't want the
if ($link['#original_link']['in_active_trail']) { // news page
// If is the first level link and it has children, we start to create the breadcrumb if ($link['#original_link']['in_active_trail'] && $link['#title'] !== 'News') {
if(!empty($link['#below']) && $link['#original_link']['depth'] === '1') { // If is the first level link and it has children,
$html .= '<ul class="breadcrumb">'; // we start to create the breadcrumb
// Now we need to attach second level menu if(!empty($link['#below']) && $link['#original_link']['depth'] === '1') {
$sub_menu = theme('links__system_main_menu', array( $html .= '<ul class="breadcrumb">';
'links' => $link['#below'], // Now we need to attach second level menu
'id' => 'breadcrumb' $sub_menu = theme('links__system_main_menu', array(
)); 'links' => $link['#below'],
$html .= $sub_menu; 'id' => 'breadcrumb'
} ));
// Second level link: could be the active one, or only a $html .= $sub_menu;
// breadcrumb for third level (or both) }
else if ($link['#original_link']['depth'] === '2') { // Second level link: could be the active one, or only a
// If it hasn't child, is the active link // breadcrumb for third level (or both)
if (empty($link['#below'])) { else if ($link['#original_link']['depth'] === '2') {
$link_title = $link['#title']; // If it hasn't child, is the active link
$link_href = $link['#href']; if (empty($link['#below'])) {
$html .= '<li class="active">' . l($link_title, $link_href, array('html' => 'true')) . '</li>'; $link_title = $link['#title'];
// We close the ul with class breadcrumb, as per design $link_href = $link['#href'];
$html .= '</ul>'; $html .= '<li class="active">' . l($link_title, $link_href, array('html' => 'true')) . '</li>';
} // We close the ul with class breadcrumb, as per design
else { $html .= '</ul>';
// If it has children could be active or not. }
// To check we need to create first the third level else {
// menu, and check if any of the third level menu links // If it has children could be active or not.
// is active // To check we need to create first the third level
list ($has_child_active_link, $third_level_menu) = valencia_third_level_menu($link['#below']); // menu, and check if any of the third level menu links
// is active
$link_title = $link['#title']; list ($has_child_active_link, $third_level_menu) = valencia_third_level_menu($link['#below']);
$link_href = $link['#href'];
$link_title = $link['#title'];
// If a child is active, this one isn't active $link_href = $link['#href'];
if ($has_child_active_link) {
$html .= '<li>' . l($link_title, $link_href, array('html' => 'true')) . '&nbsp;&rsaquo;</li>'; // If a child is active, this one isn't active
} if ($has_child_active_link) {
else { $html .= '<li>' . l($link_title, $link_href, array('html' => 'true')) . '&nbsp;&rsaquo;</li>';
$html .= '<li class="active">' . l($link_title, $link_href, array('html' => 'true')) . '</li>'; }
} else {
$html .= '<li class="active">' . l($link_title, $link_href, array('html' => 'true')) . '</li>';
// We close the ul with class breadcrumb, as per design }
$html .= '</ul>';
// We close the ul with class breadcrumb, as per design
// Then, third level menu $html .= '</ul>';
$html .= $third_level_menu;
} // Then, third level menu
} $html .= $third_level_menu;
} }
} }
} }
}
}
return $html; return $html;
} }
/** /**
......
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