3 namespace Drupal\Core\Menu;
5 use Drupal\Core\Routing\RouteMatchInterface;
8 * Defines an interface for menu local tasks.
10 * Menu local tasks are typically rendered as navigation tabs above the content
11 * region, though other presentations are possible. It is convention that the
12 * titles of these tasks should be short verbs if possible.
14 * @see \Drupal\Core\Menu\LocalTaskManagerInterface
16 interface LocalTaskInterface {
19 * Get the route name from the settings.
22 * The name of the route this local task links to.
24 public function getRouteName();
27 * Returns the localized title to be shown for this tab.
29 * Subclasses may add optional arguments like NodeInterface $node = NULL that
30 * will be supplied by the ControllerResolver.
33 * The title of the local task.
35 public function getTitle();
38 * Returns the route parameters needed to render a link for the local task.
40 * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
41 * The current route match.
44 * An array of parameter names and values.
46 public function getRouteParameters(RouteMatchInterface $route_match);
49 * Returns the weight of the local task.
52 * The weight of the task or NULL.
54 public function getWeight();
57 * Returns options for rendering a link to the local task.
59 * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
60 * The current route match.
63 * An associative array of options.
65 public function getOptions(RouteMatchInterface $route_match);
68 * Sets the active status.
71 * Sets whether this tab is active (e.g. a parent of the current tab).
73 * @return \Drupal\Core\Menu\LocalTaskInterface
74 * The called object for chaining.
76 public function setActive($active = TRUE);
79 * Gets the active status.
82 * TRUE if the local task is active, FALSE otherwise.
84 * @see \Drupal\system\Plugin\MenuLocalTaskInterface::setActive()
86 public function getActive();