You are here

public function AdminRoutes::isAdminRoute in Administration Language Negotiation 8

Checks if the current request is admin route.

Return value

bool TRUE if the current request is admin route.

1 call to AdminRoutes::isAdminRoute()
AdminRoutes::evaluate in src/Plugin/AdministrationLanguageNegotiationCondition/AdminRoutes.php
Evaluates the condition and returns TRUE or FALSE accordingly.

File

src/Plugin/AdministrationLanguageNegotiationCondition/AdminRoutes.php, line 127

Class

AdminRoutes
Class for the Blacklisted paths condition plugin.

Namespace

Drupal\administration_language_negotiation\Plugin\AdministrationLanguageNegotiationCondition

Code

public function isAdminRoute() {

  // If called from an event subscriber, the request may not have
  // the route object yet (it is still being built).
  try {
    $match = $this->router
      ->matchRequest($this->requestStack
      ->getCurrentRequest());
  } catch (ResourceNotFoundException $e) {
    return FALSE;
  } catch (AccessDeniedHttpException $e) {
    return FALSE;
  }
  if ($match && isset($match[RouteObjectInterface::ROUTE_OBJECT])) {
    return $this->adminContext
      ->isAdminRoute($match[RouteObjectInterface::ROUTE_OBJECT]);
  }
  return FALSE;
}