3 namespace Drupal\Core\Menu;
5 use Drupal\Component\Plugin\PluginManagerInterface;
6 use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
9 * Manages discovery and instantiation of menu local task plugins.
11 * This manager finds plugins that are rendered as local tasks (usually tabs).
12 * Derivatives are supported for modules that wish to generate multiple tabs on
13 * behalf of something else.
15 interface LocalTaskManagerInterface extends PluginManagerInterface {
18 * Gets the title for a local task.
20 * @param \Drupal\Core\Menu\LocalTaskInterface $local_task
21 * A local task plugin instance to get the title for.
24 * The localized title.
26 public function getTitle(LocalTaskInterface $local_task);
29 * Find all local tasks that appear on a named route.
31 * @param string $route_name
32 * The route for which to find local tasks.
35 * Returns an array of task levels. Each task level contains instances
36 * of local tasks (LocalTaskInterface) which appear on the tab route.
37 * The array keys are the depths and the values are arrays of plugin
40 public function getLocalTasksForRoute($route_name);
43 * Gets the render array for all local tasks.
45 * @param string $current_route_name
46 * The route for which to make renderable local tasks.
47 * @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $cacheability
48 * The cacheability metadata for the local tasks.
51 * A render array as expected by menu-local-tasks.html.twig.
53 public function getTasksBuild($current_route_name, RefinableCacheableDependencyInterface &$cacheability);
56 * Renders the local tasks (tabs) for the given route.
58 * @param string $route_name
59 * The route for which to make renderable local tasks.
61 * The level of tasks you ask for. Primary tasks are 0, secondary are 1.
65 * - tabs: Local tasks render array for the requested level.
66 * - route_name: The route name for the current page used to collect the
69 * @see hook_menu_local_tasks_alter()
71 public function getLocalTasks($route_name, $level = 0);