Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
toolbar_edit_page_button
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
toolbar_edit_page_button
Commits
c22a2abc
Commit
c22a2abc
authored
1 year ago
by
Peter Törnstrand
Committed by
Mattias Axelsson
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3382255
by Peter Törnstrand: Cache error
parent
2f991947
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
toolbar_edit_page_button.module
+21
-2
21 additions, 2 deletions
toolbar_edit_page_button.module
with
21 additions
and
2 deletions
toolbar_edit_page_button.module
+
21
−
2
View file @
c22a2abc
...
...
@@ -17,8 +17,8 @@ use Drupal\node\NodeInterface;
function
toolbar_edit_page_button_toolbar
()
{
$node
=
\Drupal
::
routeMatch
()
->
getParameter
(
'node'
);
$permission
=
\Drupal
::
currentUser
()
->
hasPermission
(
'access toolbar edit page button'
);
$items
=
[];
if
(
$permission
&&
$node
instanceof
NodeInterface
)
{
$items
=
[];
$nid
=
$node
->
id
();
$items
[
'toolbar_edit_page_button'
]
=
[
'#type'
=>
'toolbar_item'
,
...
...
@@ -40,6 +40,25 @@ function toolbar_edit_page_button_toolbar() {
],
],
];
return
$items
;
}
else
{
$items
[
'toolbar_edit_page_button'
]
=
[
'#type'
=>
'toolbar_item'
,
'tab'
=>
[
'#type'
=>
'link'
,
'#title'
=>
t
(
'Edit page'
),
'#url'
=>
Url
::
fromRoute
(
'<front>'
),
'#cache'
=>
[
'contexts'
=>
[
'url.path'
,
],
],
],
'#wrapper_attributes'
=>
[
'class'
=>
[
'edit-toolbar-tab'
,
'visually-hidden'
],
],
];
}
return
$items
;
}
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