Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Core\Menu;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Component\Plugin\PluginManagerInterface;
|
Chris@0
|
6 use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
|
Chris@0
|
7
|
Chris@0
|
8 /**
|
Chris@0
|
9 * Manages discovery and instantiation of menu local task plugins.
|
Chris@0
|
10 *
|
Chris@0
|
11 * This manager finds plugins that are rendered as local tasks (usually tabs).
|
Chris@0
|
12 * Derivatives are supported for modules that wish to generate multiple tabs on
|
Chris@0
|
13 * behalf of something else.
|
Chris@0
|
14 */
|
Chris@0
|
15 interface LocalTaskManagerInterface extends PluginManagerInterface {
|
Chris@0
|
16
|
Chris@0
|
17 /**
|
Chris@0
|
18 * Gets the title for a local task.
|
Chris@0
|
19 *
|
Chris@0
|
20 * @param \Drupal\Core\Menu\LocalTaskInterface $local_task
|
Chris@0
|
21 * A local task plugin instance to get the title for.
|
Chris@0
|
22 *
|
Chris@0
|
23 * @return string
|
Chris@0
|
24 * The localized title.
|
Chris@0
|
25 */
|
Chris@0
|
26 public function getTitle(LocalTaskInterface $local_task);
|
Chris@0
|
27
|
Chris@0
|
28 /**
|
Chris@0
|
29 * Find all local tasks that appear on a named route.
|
Chris@0
|
30 *
|
Chris@0
|
31 * @param string $route_name
|
Chris@0
|
32 * The route for which to find local tasks.
|
Chris@0
|
33 *
|
Chris@0
|
34 * @return array
|
Chris@0
|
35 * Returns an array of task levels. Each task level contains instances
|
Chris@0
|
36 * of local tasks (LocalTaskInterface) which appear on the tab route.
|
Chris@0
|
37 * The array keys are the depths and the values are arrays of plugin
|
Chris@0
|
38 * instances.
|
Chris@0
|
39 */
|
Chris@0
|
40 public function getLocalTasksForRoute($route_name);
|
Chris@0
|
41
|
Chris@0
|
42 /**
|
Chris@0
|
43 * Gets the render array for all local tasks.
|
Chris@0
|
44 *
|
Chris@0
|
45 * @param string $current_route_name
|
Chris@0
|
46 * The route for which to make renderable local tasks.
|
Chris@0
|
47 * @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $cacheability
|
Chris@0
|
48 * The cacheability metadata for the local tasks.
|
Chris@0
|
49 *
|
Chris@0
|
50 * @return array
|
Chris@0
|
51 * A render array as expected by menu-local-tasks.html.twig.
|
Chris@0
|
52 */
|
Chris@0
|
53 public function getTasksBuild($current_route_name, RefinableCacheableDependencyInterface &$cacheability);
|
Chris@0
|
54
|
Chris@0
|
55 /**
|
Chris@0
|
56 * Renders the local tasks (tabs) for the given route.
|
Chris@0
|
57 *
|
Chris@0
|
58 * @param string $route_name
|
Chris@0
|
59 * The route for which to make renderable local tasks.
|
Chris@0
|
60 * @param int $level
|
Chris@0
|
61 * The level of tasks you ask for. Primary tasks are 0, secondary are 1.
|
Chris@0
|
62 *
|
Chris@0
|
63 * @return array
|
Chris@0
|
64 * An array containing
|
Chris@0
|
65 * - tabs: Local tasks render array for the requested level.
|
Chris@0
|
66 * - route_name: The route name for the current page used to collect the
|
Chris@0
|
67 * local tasks.
|
Chris@0
|
68 *
|
Chris@0
|
69 * @see hook_menu_local_tasks_alter()
|
Chris@0
|
70 */
|
Chris@0
|
71 public function getLocalTasks($route_name, $level = 0);
|
Chris@0
|
72
|
Chris@0
|
73 }
|