You are here

public function ViewRevisionsRequest::isViewAdminRoute in Config Entity Revisions 8

Same name and namespace in other branches
  1. 1.x modules/views_revisions/src/ViewsRevisionsRequest.php \Drupal\views_revisions\ViewRevisionsRequest::isViewAdminRoute()

File

modules/views_revisions/src/ViewsRevisionsRequest.php, line 126

Class

ViewRevisionsRequest
Handles view requests.

Namespace

Drupal\views_revisions

Code

public function isViewAdminRoute() {
  if (isset($this->isAdminRoute)) {
    return $this->isAdminRoute;
  }

  // Make sure the current route is an admin route.
  if (!$this->adminContext
    ->isAdminRoute()) {
    $this->isAdminRoute = FALSE;
    return $this->isAdminRoute;
  }
  $route_name = $this->routeMatch
    ->getRouteName();
  if (in_array($route_name, [
    'entity.view.canonical',
    'entity.view_submission.edit_form',
  ])) {
    $this->isAdminRoute = FALSE;
  }
  else {
    $this->isAdminRoute = preg_match('/^(view\\.|^entity\\.([^.]+\\.)?view)/', $route_name) ? TRUE : FALSE;
  }
  return $this->isAdminRoute;
}