Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
domain_menu_access
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
domain_menu_access
Commits
abd8e457
Commit
abd8e457
authored
10 months ago
by
Tim Diels
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3221019
by tim-diels, ilya.no, gaurav.bajpai: Config "Expand all menu links" is not handled
parent
ce915e6d
No related branches found
No related tags found
1 merge request
!12
Add schema and copy code from system menu block to fix expand all menu links
Pipeline
#147805
passed
10 months ago
Stage: build
Stage: validate
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/schema/domain_menu_access.schema.yml
+13
-0
13 additions, 0 deletions
config/schema/domain_menu_access.schema.yml
src/Plugin/Block/DomainMenuAccessMenuBlock.php
+10
-1
10 additions, 1 deletion
src/Plugin/Block/DomainMenuAccessMenuBlock.php
with
23 additions
and
1 deletion
config/schema/domain_menu_access.schema.yml
+
13
−
0
View file @
abd8e457
...
...
@@ -6,3 +6,16 @@ domain_menu_access.settings:
label
:
'
Menu
enabled'
sequence
:
type
:
string
block.settings.domain_access_menu_block:*
:
type
:
block_settings
label
:
'
Menu
block'
mapping
:
level
:
type
:
integer
label
:
'
Starting
level'
depth
:
type
:
integer
label
:
'
Maximum
number
of
levels'
expand_all_items
:
type
:
boolean
label
:
'
Expand
all
items'
This diff is collapsed.
Click to expand it.
src/Plugin/Block/DomainMenuAccessMenuBlock.php
+
10
−
1
View file @
abd8e457
...
...
@@ -6,6 +6,7 @@ use Drupal\Core\Cache\Cache;
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Core\Menu\MenuActiveTrailInterface
;
use
Drupal\Core\Menu\MenuLinkTreeInterface
;
use
Drupal\Core\Menu\MenuTreeParameters
;
use
Drupal\Core\Plugin\ContainerFactoryPluginInterface
;
use
Drupal\system\Plugin\Block\SystemMenuBlock
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
...
...
@@ -75,7 +76,15 @@ class DomainMenuAccessMenuBlock extends SystemMenuBlock implements ContainerFact
if
(
!
$this
->
isDomainRestricted
(
$menu_name
))
{
return
parent
::
build
();
}
$parameters
=
$this
->
menuTree
->
getCurrentRouteMenuTreeParameters
(
$menu_name
);
if
(
$this
->
configuration
[
'expand_all_items'
])
{
$parameters
=
new
MenuTreeParameters
();
$active_trail
=
$this
->
menuActiveTrail
->
getActiveTrailIds
(
$menu_name
);
$parameters
->
setActiveTrail
(
$active_trail
);
}
else
{
$parameters
=
$this
->
menuTree
->
getCurrentRouteMenuTreeParameters
(
$menu_name
);
}
// Adjust the menu tree parameters based on the block's configuration.
$level
=
$this
->
configuration
[
'level'
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment