Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Core\Menu;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\Routing\RouteMatchInterface;
|
Chris@0
|
6
|
Chris@0
|
7 /**
|
Chris@0
|
8 * Defines an interface for menu local tasks.
|
Chris@0
|
9 *
|
Chris@0
|
10 * Menu local tasks are typically rendered as navigation tabs above the content
|
Chris@0
|
11 * region, though other presentations are possible. It is convention that the
|
Chris@0
|
12 * titles of these tasks should be short verbs if possible.
|
Chris@0
|
13 *
|
Chris@0
|
14 * @see \Drupal\Core\Menu\LocalTaskManagerInterface
|
Chris@0
|
15 */
|
Chris@0
|
16 interface LocalTaskInterface {
|
Chris@0
|
17
|
Chris@0
|
18 /**
|
Chris@0
|
19 * Get the route name from the settings.
|
Chris@0
|
20 *
|
Chris@0
|
21 * @return string
|
Chris@0
|
22 * The name of the route this local task links to.
|
Chris@0
|
23 */
|
Chris@0
|
24 public function getRouteName();
|
Chris@0
|
25
|
Chris@0
|
26 /**
|
Chris@0
|
27 * Returns the localized title to be shown for this tab.
|
Chris@0
|
28 *
|
Chris@0
|
29 * Subclasses may add optional arguments like NodeInterface $node = NULL that
|
Chris@0
|
30 * will be supplied by the ControllerResolver.
|
Chris@0
|
31 *
|
Chris@0
|
32 * @return string
|
Chris@0
|
33 * The title of the local task.
|
Chris@0
|
34 */
|
Chris@0
|
35 public function getTitle();
|
Chris@0
|
36
|
Chris@0
|
37 /**
|
Chris@0
|
38 * Returns the route parameters needed to render a link for the local task.
|
Chris@0
|
39 *
|
Chris@0
|
40 * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
|
Chris@0
|
41 * The current route match.
|
Chris@0
|
42 *
|
Chris@0
|
43 * @return array
|
Chris@0
|
44 * An array of parameter names and values.
|
Chris@0
|
45 */
|
Chris@0
|
46 public function getRouteParameters(RouteMatchInterface $route_match);
|
Chris@0
|
47
|
Chris@0
|
48 /**
|
Chris@0
|
49 * Returns the weight of the local task.
|
Chris@0
|
50 *
|
Chris@0
|
51 * @return int|null
|
Chris@0
|
52 * The weight of the task or NULL.
|
Chris@0
|
53 */
|
Chris@0
|
54 public function getWeight();
|
Chris@0
|
55
|
Chris@0
|
56 /**
|
Chris@0
|
57 * Returns options for rendering a link to the local task.
|
Chris@0
|
58 *
|
Chris@0
|
59 * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
|
Chris@0
|
60 * The current route match.
|
Chris@0
|
61 *
|
Chris@0
|
62 * @return array
|
Chris@0
|
63 * An associative array of options.
|
Chris@0
|
64 */
|
Chris@0
|
65 public function getOptions(RouteMatchInterface $route_match);
|
Chris@0
|
66
|
Chris@0
|
67 /**
|
Chris@0
|
68 * Sets the active status.
|
Chris@0
|
69 *
|
Chris@0
|
70 * @param bool $active
|
Chris@0
|
71 * Sets whether this tab is active (e.g. a parent of the current tab).
|
Chris@0
|
72 *
|
Chris@0
|
73 * @return \Drupal\Core\Menu\LocalTaskInterface
|
Chris@0
|
74 * The called object for chaining.
|
Chris@0
|
75 */
|
Chris@0
|
76 public function setActive($active = TRUE);
|
Chris@0
|
77
|
Chris@0
|
78 /**
|
Chris@0
|
79 * Gets the active status.
|
Chris@0
|
80 *
|
Chris@0
|
81 * @return bool
|
Chris@0
|
82 * TRUE if the local task is active, FALSE otherwise.
|
Chris@0
|
83 *
|
Chris@0
|
84 * @see \Drupal\system\Plugin\MenuLocalTaskInterface::setActive()
|
Chris@0
|
85 */
|
Chris@0
|
86 public function getActive();
|
Chris@0
|
87
|
Chris@0
|
88 }
|