Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Menu / LocalTaskManagerInterface.php
1 <?php
2
3 namespace Drupal\Core\Menu;
4
5 use Drupal\Component\Plugin\PluginManagerInterface;
6 use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
7
8 /**
9  * Manages discovery and instantiation of menu local task plugins.
10  *
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.
14  */
15 interface LocalTaskManagerInterface extends PluginManagerInterface {
16
17   /**
18    * Gets the title for a local task.
19    *
20    * @param \Drupal\Core\Menu\LocalTaskInterface $local_task
21    *   A local task plugin instance to get the title for.
22    *
23    * @return string
24    *   The localized title.
25    */
26   public function getTitle(LocalTaskInterface $local_task);
27
28   /**
29    * Find all local tasks that appear on a named route.
30    *
31    * @param string $route_name
32    *   The route for which to find local tasks.
33    *
34    * @return array
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
38    *   instances.
39    */
40   public function getLocalTasksForRoute($route_name);
41
42   /**
43    * Gets the render array for all local tasks.
44    *
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.
49    *
50    * @return array
51    *   A render array as expected by menu-local-tasks.html.twig.
52    */
53   public function getTasksBuild($current_route_name, RefinableCacheableDependencyInterface &$cacheability);
54
55   /**
56    * Renders the local tasks (tabs) for the given route.
57    *
58    * @param string $route_name
59    *   The route for which to make renderable local tasks.
60    * @param int $level
61    *   The level of tasks you ask for. Primary tasks are 0, secondary are 1.
62    *
63    * @return array
64    *   An array containing
65    *   - tabs: Local tasks render array for the requested level.
66    *   - route_name: The route name for the current page used to collect the
67    *     local tasks.
68    *
69    * @see hook_menu_local_tasks_alter()
70    */
71   public function getLocalTasks($route_name, $level = 0);
72
73 }