Skip to content
Snippets Groups Projects
Unverified Commit 3f70e701 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2945184 by samuel.mortenson: Third argument passed to...

Issue #2945184 by samuel.mortenson: Third argument passed to hook_menu_local_tasks_alter is undocumented
parent d27a372a
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -302,10 +302,12 @@ function hook_menu_links_discovered_alter(&$links) {
* as described above.
* @param string $route_name
* The route name of the page.
* @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $cacheability
* The cacheability metadata for the current route's local tasks.
*
* @ingroup menu
*/
function hook_menu_local_tasks_alter(&$data, $route_name) {
function hook_menu_local_tasks_alter(&$data, $route_name, \Drupal\Core\Cache\RefinableCacheableDependencyInterface &$cacheability) {
// Add a tab linking to node/add to all pages.
$data['tabs'][0]['node.add_page'] = [
......@@ -320,6 +322,8 @@ function hook_menu_local_tasks_alter(&$data, $route_name) {
],
],
];
// The tab we're adding is dependent on a user's access to add content.
$cacheability->addCacheTags(['user.permissions']);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment