Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
valencia
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
9
Issues
9
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
valencia
Commits
36eef2cc
Commit
36eef2cc
authored
Aug 31, 2014
by
Riccardo Padovani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove breadcrumb if there isn't a third level menù
parent
61bf9a67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
47 deletions
+49
-47
template.php
template.php
+49
-47
No files found.
template.php
View file @
36eef2cc
...
@@ -302,9 +302,11 @@ function valencia_breadcrumb_menu($vars) {
...
@@ -302,9 +302,11 @@ function valencia_breadcrumb_menu($vars) {
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, and we don't want the
// We need only active links, with children and we
// news page
// don't want the news page
if
(
$link
[
'#original_link'
][
'in_active_trail'
]
&&
$link
[
'#title'
]
!==
'News'
)
{
if
(
$link
[
'#original_link'
][
'in_active_trail'
]
&&
!
empty
(
$link
[
'#below'
])
&&
$link
[
'#title'
]
!==
'News'
)
{
// If is the first level link and it has children,
// If is the first level link and it has children,
// we start to create the breadcrumb
// we start to create the breadcrumb
if
(
!
empty
(
$link
[
'#below'
])
&&
$link
[
'#original_link'
][
'depth'
]
===
'1'
)
{
if
(
!
empty
(
$link
[
'#below'
])
&&
$link
[
'#original_link'
][
'depth'
]
===
'1'
)
{
...
@@ -410,52 +412,52 @@ function valencia_third_level_menu($vars) {
...
@@ -410,52 +412,52 @@ function valencia_third_level_menu($vars) {
* https://gitlab.com/ubuntu-it-web/valencia/issues/6
* https://gitlab.com/ubuntu-it-web/valencia/issues/6
*/
*/
function
valencia_footer_menu
(
$vars
)
{
function
valencia_footer_menu
(
$vars
)
{
// Var with all HTML of the menu
// Var with all HTML of the menu
$html
=
'<ul>'
;
$html
=
'<ul>'
;
// Counter to select first element of every submenu to add class .first
// Counter to select first element of every submenu to add class .first
$voice_number
=
0
;
$voice_number
=
0
;
foreach
(
$vars
[
'links'
]
as
$key
=>
$link
)
{
// To print every menu voice only one, see Drupal API
if
(
is_numeric
(
$key
))
{
// Store the submenu links
$sub_menu
=
''
;
$link_title
=
$link
[
'#title'
];
// Check for submenu, but only if they are of first level!
if
(
!
empty
(
$link
[
'#below'
])
&&
$link
[
'#original_link'
][
'depth'
]
===
'1'
)
{
// If there is a submenu create it using the same function
$sub_menu
=
theme
(
'links__system_main_menu'
,
array
(
'links'
=>
$link
[
'#below'
],
'id'
=>
'footer'
));
}
/**
foreach
(
$vars
[
'links'
]
as
$key
=>
$link
)
{
* We have 3 types of link:
// To print every menu voice only one, see Drupal API
* - First level link, they are h2 title, and will be identify for
if
(
is_numeric
(
$key
))
{
* by their depth of 1
// Store the submenu links
* - First link of second level menus, they have class .first,
$sub_menu
=
''
;
* identified by $voice_number
$link_title
=
$link
[
'#title'
];
* - Others links of second level menus
// Check for submenu, but only if they are of first level!
*/
if
(
!
empty
(
$link
[
'#below'
])
&&
$link
[
'#original_link'
][
'depth'
]
===
'1'
)
{
if
(
$link
[
'#original_link'
][
'depth'
]
===
'1'
)
{
// If there is a submenu create it using the same function
// First level menu is h2
$sub_menu
=
theme
(
'links__system_main_menu'
,
array
(
$html
.=
'<li><h2>'
.
l
(
$link_title
,
$link
[
'#href'
],
array
(
'html'
=>
'true'
))
.
'</h2>'
.
$sub_menu
.
'</li>'
;
'links'
=>
$link
[
'#below'
],
}
'id'
=>
'footer'
else
if
(
$voice_number
===
0
)
{
));
// The first submenu of every menu has class first
}
$html
.=
'<li class="first">'
.
l
(
$link_title
,
$link
[
'#href'
],
array
(
'html'
=>
'true'
))
.
$sub_menu
.
'</li>'
;
}
else
{
// Submenu voice
$html
.=
'<li>'
.
l
(
$link_title
,
$link
[
'#href'
],
array
(
'html'
=>
'true'
))
.
$sub_menu
.
'</li>'
;
}
$voice_number
++
;
}
}
$html
.=
'</ul>'
;
/**
return
$html
;
* We have 3 types of link:
* - First level link, they are h2 title, and will be identify for
* by their depth of 1
* - First link of second level menus, they have class .first,
* identified by $voice_number
* - Others links of second level menus
*/
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
)
{
// The first submenu of every menu has class first
$html
.=
'<li class="first">'
.
l
(
$link_title
,
$link
[
'#href'
],
array
(
'html'
=>
'true'
))
.
$sub_menu
.
'</li>'
;
}
else
{
// Submenu voice
$html
.=
'<li>'
.
l
(
$link_title
,
$link
[
'#href'
],
array
(
'html'
=>
'true'
))
.
$sub_menu
.
'</li>'
;
}
$voice_number
++
;
}
}
$html
.=
'</ul>'
;
return
$html
;
}
}
if
(
!
function_exists
(
'region_empty'
)
)
:
if
(
!
function_exists
(
'region_empty'
)
)
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment