MARK
MARK = '#anachron_key'
Calls `hook_menu_local_tasks_alter()` with the arguments each implementation was written for.
Drupal 7 passed (&$data, $router_item, $root_path) with tabs and actions as lists of
menu_local_task render arrays. Drupal 11 passes (&$data, $route_name, $cacheability) with
tabs keyed by plugin id. An implementation whose second parameter is route_name or a string
is a Drupal 11 one and is called as core calls it. Any other is a Drupal 7 one: it gets the
tabs rebuilt in the Drupal 7 shape and its edits are folded back. Tabs it removes are removed,
tabs it adds are added with an access check, a changed title or weight is kept. Local actions
it adds are not applied, because Drupal 11 builds actions in another manager, and each one is
recorded as refused. LegacyAlterModuleHandler routes the alter here.
__construct(\Drupal\Core\Extension\ModuleHandlerInterface $handler, callable $rootPath) : mixed
| \Drupal\Core\Extension\ModuleHandlerInterface | $handler | The handler that finds the implementations. |
| callable | $rootPath | Maps a route name to the Drupal 7 router path, such as |
run(array$data, string $route_name, \Drupal\Core\Cache\CacheableMetadata $cacheability) : void
Runs the `menu_local_tasks` alter, giving each implementation its own arguments.
| array |
$data | The Drupal 11 data, edited in place. |
| string | $route_name | The route the tasks are for. |
| \Drupal\Core\Cache\CacheableMetadata | $cacheability | The cacheability the implementations add to. |
callLegacy(callable $hook, string $module, array$data, string $route_name, \Drupal\Core\Cache\CacheableMetadata $cacheability) : void
Calls one Drupal 7 implementation and folds its edits into the Drupal 11 data.
| callable | $hook | The implementation. |
| string | $module | The module that owns it. |
| array |
$data | The Drupal 11 data, edited in place. |
| string | $route_name | The route the tasks are for. |
| \Drupal\Core\Cache\CacheableMetadata | $cacheability | The cacheability to add the access results to. |
toLegacyData(array$data, string $root_path) : array<string,mixed>
Builds the Drupal 7 data array from the Drupal 11 one.
| array |
$data | The Drupal 11 data. |
| string | $root_path | The Drupal 7 router path. |
Tabs by level and an empty action list, as hook_menu_local_tasks_alter() received them.
foldBack(array$data, array > $tabs, string $module, \Drupal\Core\Cache\CacheableMetadata $cacheability) : void
Applies what a Drupal 7 implementation did to the tabs.
| array |
$data | The Drupal 11 data, edited in place. |
| array |
$tabs | The Drupal 7 tabs after the call. |
| string | $module | The module that made the edits. |
| \Drupal\Core\Cache\CacheableMetadata | $cacheability | The cacheability to add access results to. |
addTab(array$data, int|string $level, string $key, array $tab, string $module, \Drupal\Core\Cache\CacheableMetadata $cacheability) : void
Adds a tab that a Drupal 7 implementation created, denied unless access can be decided.
| array |
$data | The Drupal 11 data, edited in place. |
| int|string | $level | The tab level. |
| string | $key | The key to store the tab under. |
| array |
$tab | The Drupal 7 tab. |
| string | $module | The module that added it. |
| \Drupal\Core\Cache\CacheableMetadata | $cacheability | The cacheability to add the access result to. |