Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bootstrap
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
bootstrap
Commits
c9203d89
Unverified
Commit
c9203d89
authored
May 7, 2019
by
Ian McLean
Committed by
Mark Halliwell
May 7, 2019
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3045621
by imclean, jungle: Menu items encounter NULL attributes
parent
cf948b75
No related branches found
No related tags found
1 merge request
!40
Draft: Automated Project Update Bot fixes
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Plugin/Preprocess/Menu.php
+14
-1
14 additions, 1 deletion
src/Plugin/Preprocess/Menu.php
with
14 additions
and
1 deletion
src/Plugin/Preprocess/Menu.php
+
14
−
1
View file @
c9203d89
...
...
@@ -20,7 +20,17 @@ class Menu extends PreprocessBase implements PreprocessInterface {
* {@inheritdoc}
*/
protected
function
preprocessVariables
(
Variables
$variables
)
{
foreach
(
$variables
->
items
as
&
$item
)
{
$this
->
convertAttributes
(
$variables
->
items
);
}
/**
* Converts attributes to core's Attribute class.
*
* @param array $items
* The menu items.
*/
protected
function
convertAttributes
(
array
&
$items
)
{
foreach
(
$items
as
&
$item
)
{
$wrapperAttributes
=
new
Attributes
();
$linkAttributes
=
new
Attributes
();
if
(
$item
[
'attributes'
]
instanceof
Attribute
||
$item
[
'attributes'
]
instanceof
Attributes
)
{
...
...
@@ -37,6 +47,9 @@ class Menu extends PreprocessBase implements PreprocessInterface {
// around this, just rewrap attributes in core's native Attribute class.
$item
[
'attributes'
]
=
new
Attribute
(
$wrapperAttributes
->
getArrayCopy
());
$item
[
'link_attributes'
]
=
new
Attribute
(
$linkAttributes
->
getArrayCopy
());
if
(
$item
[
'below'
])
{
$this
->
convertAttributes
(
$item
[
'below'
]);
}
}
}
...
...
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