Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dic-global-dev
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Manzar Hussain
dic-global-dev
Commits
dbd15a01
Commit
dbd15a01
authored
Jan 14, 2021
by
Manzar Hussain
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-theme' into 'develop'
add active See merge request manzarH/dic-global-dev!390
parents
7459543b
88f5d42e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletions
+34
-1
envigo.theme
themes/custom/envigo/envigo.theme
+30
-0
menu--si.html.twig
themes/custom/envigo/templates/navigation/menu--si.html.twig
+4
-1
No files found.
themes/custom/envigo/envigo.theme
View file @
dbd15a01
...
@@ -31,5 +31,35 @@ function envigo_form_search_block_form_alter(&$form, &$form_state) {
...
@@ -31,5 +31,35 @@ function envigo_form_search_block_form_alter(&$form, &$form_state) {
$form['actions']['submit']['#attributes']['class'][] = 'search-button';
$form['actions']['submit']['#attributes']['class'][] = 'search-button';
}
}
function envigo_preprocess_menu(&$variables, $hook) {
if ($hook == 'menu') {
$current_path = \Drupal::request()->getRequestUri();
foreach ($variables['items'] as &$item) {
if ($item['in_active_trail']) {
if ($item['url']->toString() == $current_path) {
$item['is_active'] = TRUE;
} elseif (count($item['below'])) {
_themename_menu_process_submenu($item['below'], $current_path);
}
}
}
}
}
/**
* Set active and active-trail class for sub-menus recursively.
*/
function _envigo_menu_process_submenu(&$submenu, $current_path) {
foreach ($submenu as &$item) {
if ($item['in_active_trail']) {
if ($item['url']->toString() == $current_path) {
$item['is_active'] = TRUE;
} elseif (count($item['below'])) {
_themename_menu_process_submenu($item['below'], $current_path);
}
}
}
}
themes/custom/envigo/templates/navigation/menu--si.html.twig
View file @
dbd15a01
...
@@ -43,9 +43,12 @@
...
@@ -43,9 +43,12 @@
'menu-item'
,
'menu-item'
,
item.is_expanded
?
'dd_sub_menu'
,
item.is_expanded
?
'dd_sub_menu'
,
item.is_collapsed
?
'menu-item--collapsed'
,
item.is_collapsed
?
'menu-item--collapsed'
,
item.i
n_active_trail
?
'active_sb'
:
'
'
,
item.i
s_active
?
'active_sb
'
,
]
]
%}
%}
<li
{{
item.attributes.addClass
(
classes
)
}}
>
<li
{{
item.attributes.addClass
(
classes
)
}}
>
<div
{%
if
item.below
%}
style=
"display: none;"
{%
endif
%}
>
{{
link
(
item.title
,
item.url
)
}}
</div>
<div
{%
if
item.below
%}
style=
"display: none;"
{%
endif
%}
>
{{
link
(
item.title
,
item.url
)
}}
</div>
{%
if
item.below
%}
{%
if
item.below
%}
...
...
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