Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
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
drupal
Merge requests
!10289
Resolve
#2885278
"New 11.x"
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Open
Resolve
#2885278
"New 11.x"
issue/drupal-2885278:2885278-new-11.x
into
11.x
Overview
12
Commits
18
Pipelines
14
Changes
3
Open
Resolve #2885278 "New 11.x"
andrew farquharson
requested to merge
issue/drupal-2885278:2885278-new-11.x
into
11.x
8 months ago
Overview
8
Commits
18
Pipelines
14
Changes
3
Closes
#2885278
0
0
Merge request reports
Compare
11.x
version 13
246c6ab6
1 month ago
version 12
fee25cc8
1 month ago
version 11
fcd1614d
1 month ago
version 10
3438bd2d
2 months ago
version 9
1a3fb764
2 months ago
version 8
cbb19f52
2 months ago
version 7
eab4b903
2 months ago
version 6
bd2c51b3
8 months ago
version 5
31a32f26
8 months ago
version 4
a8d6ed6e
8 months ago
version 3
978e7aee
8 months ago
version 2
fa20cc96
8 months ago
version 1
8b9c585a
8 months ago
11.x (HEAD)
and
latest version
latest version
bb82b9fe
18 commits,
1 month ago
version 13
246c6ab6
17 commits,
1 month ago
version 12
fee25cc8
16 commits,
1 month ago
version 11
fcd1614d
15 commits,
1 month ago
version 10
3438bd2d
12 commits,
2 months ago
version 9
1a3fb764
11 commits,
2 months ago
version 8
cbb19f52
10 commits,
2 months ago
version 7
eab4b903
8 commits,
2 months ago
version 6
bd2c51b3
7 commits,
8 months ago
version 5
31a32f26
6 commits,
8 months ago
version 4
a8d6ed6e
5 commits,
8 months ago
version 3
978e7aee
4 commits,
8 months ago
version 2
fa20cc96
3 commits,
8 months ago
version 1
8b9c585a
2 commits,
8 months ago
3 files
+
143
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
core/modules/node/src/Hook/NodeHooks.php
+
31
−
0
View file @ 79355790
Edit in single-file editor
Open in Web IDE
Show full file
@@ -4,6 +4,8 @@
namespace
Drupal\node\Hook
;
use
Drupal\Core\Cache\CacheableMetadata
;
use
Drupal\Core\Cache\RefinableCacheableDependencyInterface
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Drupal\Core\Hook\Attribute\Hook
;
use
Drupal\Core\Extension\ModuleHandlerInterface
;
@@ -66,6 +68,35 @@ public function userCancelReassign($edit, UserInterface $account, $method): void
}
}
/**
* Implements hook_menu_local_tasks_alter().
*/
#[Hook('menu_local_tasks_alter')]
public
function
nodeLocalMenuAlter
(
&
$local_tasks
,
$route_name
,
RefinableCacheableDependencyInterface
&
$cacheability
)
:
void
{
if
(
$route_name
===
'entity.node.revision'
)
{
// Show the same local tasks on node revision pages as the ones displayed
// on node canonical pages.
$node_canonical_local_tasks
=
\Drupal
::
service
(
'plugin.manager.menu.local_task'
)
->
getLocalTasks
(
'entity.node.canonical'
);
$local_tasks
[
'tabs'
][
0
]
=
$node_canonical_local_tasks
[
'tabs'
];
// Mark the version history local task as active when viewing a node
// revision.
foreach
(
$local_tasks
[
'tabs'
][
0
]
as
$route_name
=>
&
$tab
)
{
$tab
[
'#active'
]
=
$route_name
===
'entity.node.version_history'
;
}
$cacheability
=
CacheableMetadata
::
createFromObject
(
$cacheability
)
->
merge
(
$node_canonical_local_tasks
[
'cacheability'
]);
}
}
/**
* Implements hook_config_translation_info_alter().
*/
#[Hook('config_translation_info_alter')]
public
function
nodeConfigTranslationInfoAlter
(
&
$info
)
:
void
{
$info
[
'node_type'
][
'class'
]
=
'Drupal\node\ConfigTranslation\NodeTypeMapper'
;
}
/**
* Implements hook_block_alter().
*/
Loading