function AdminContext::isAdminRoute

Same name in other branches
  1. 9 core/lib/Drupal/Core/Routing/AdminContext.php \Drupal\Core\Routing\AdminContext::isAdminRoute()
  2. 8.9.x core/lib/Drupal/Core/Routing/AdminContext.php \Drupal\Core\Routing\AdminContext::isAdminRoute()
  3. 11.x core/lib/Drupal/Core/Routing/AdminContext.php \Drupal\Core\Routing\AdminContext::isAdminRoute()

Determines whether the active route is an admin one.

Parameters

\Symfony\Component\Routing\Route $route: (optional) The route to determine whether it is an admin one. Per default this falls back to the route object on the active request.

Return value

bool Returns TRUE if the route is an admin one, otherwise FALSE.

File

core/lib/Drupal/Core/Routing/AdminContext.php, line 39

Class

AdminContext
Provides a helper class to determine whether the route is an admin one.

Namespace

Drupal\Core\Routing

Code

public function isAdminRoute(?Route $route = NULL) {
    if (!$route) {
        $route = $this->routeMatch
            ->getRouteObject();
        if (!$route) {
            return FALSE;
        }
    }
    return (bool) $route->getOption('_admin_route');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.