interface LocalTaskInterface (View source)

Defines an interface for menu local tasks.

Menu local tasks are typically rendered as navigation tabs above the content region, though other presentations are possible. It is convention that the titles of these tasks should be short verbs if possible.

Methods

string
getRouteName()

Get the route name from the settings.

string
getTitle()

Returns the localized title to be shown for this tab.

array
getRouteParameters(RouteMatchInterface $route_match)

Returns the route parameters needed to render a link for the local task.

int|null
getWeight()

Returns the weight of the local task.

array
getOptions(RouteMatchInterface $route_match)

Returns options for rendering a link to the local task.

$this
setActive(bool $active = TRUE)

Sets the active status.

bool
getActive()

Gets the active status.

Details

string getRouteName()

Get the route name from the settings.

Return Value

string

The name of the route this local task links to.

string getTitle()

Returns the localized title to be shown for this tab.

Subclasses may add optional arguments like NodeInterface $node = NULL that will be supplied by the ControllerResolver.

Return Value

string

The title of the local task.

array getRouteParameters(RouteMatchInterface $route_match)

Returns the route parameters needed to render a link for the local task.

Parameters

RouteMatchInterface $route_match

The current route match.

Return Value

array

An array of parameter names and values.

int|null getWeight()

Returns the weight of the local task.

Return Value

int|null

The weight of the task or NULL.

array getOptions(RouteMatchInterface $route_match)

Returns options for rendering a link to the local task.

Parameters

RouteMatchInterface $route_match

The current route match.

Return Value

array

An associative array of options.

$this setActive(bool $active = TRUE)

Sets the active status.

Parameters

bool $active

Sets whether this tab is active (e.g. a parent of the current tab).

Return Value

$this

The called object for chaining.

bool getActive()

Gets the active status.

Return Value

bool

TRUE if the local task is active, FALSE otherwise.

See also

\Drupal\system\Plugin\MenuLocalTaskInterface::setActive()