protected LocalTaskManager::isRouteActive($current_route_name, $route_name, $route_parameters)
Determines whether the route of a certain local task is currently active.
Parameters
string $current_route_name: The route name of the current main request.
string $route_name: The route name of the local task to determine the active status.
array $route_parameters:
Return value
bool Returns TRUE if the passed route_name and route_parameters is considered as the same as the one from the request, otherwise FALSE.
File
- core/lib/Drupal/Core/Menu/LocalTaskManager.php, line 397
Class
- LocalTaskManager
- Provides the default local task manager using YML as primary definition.
Namespace
Drupal\Core\Menu
Code
protected function isRouteActive($current_route_name, $route_name, $route_parameters) { // Flag the list element as active if this tab's route and parameters match // the current request's route and route variables. $active = $current_route_name == $route_name; if ($active) { // The request is injected, so we need to verify that we have the expected // _raw_variables attribute. $raw_variables_bag = $this->routeMatch->getRawParameters(); // If we don't have _raw_variables, we assume the attributes are still the // original values. $raw_variables = $raw_variables_bag ? $raw_variables_bag->all() : $this->routeMatch->getParameters()->all(); $active = array_intersect_assoc($route_parameters, $raw_variables) == $route_parameters; } return $active; }
Please login to continue.