You are here

public function WebformRevisionsRequest::isWebformAdminRoute in Config Entity Revisions 8

Same name and namespace in other branches
  1. 8.2 modules/webform_revisions/src/WebformRevisionsRequest.php \Drupal\webform_revisions\WebformRevisionsRequest::isWebformAdminRoute()
  2. 1.x modules/webform_revisions/src/WebformRevisionsRequest.php \Drupal\webform_revisions\WebformRevisionsRequest::isWebformAdminRoute()

Determine if the current request is a webform admin route.

Return value

bool TRUE if the current request is a webform admin route.

Overrides WebformRequest::isWebformAdminRoute

File

modules/webform_revisions/src/WebformRevisionsRequest.php, line 126

Class

WebformRevisionsRequest
Handles webform requests.

Namespace

Drupal\webform_revisions

Code

public function isWebformAdminRoute() {
  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.webform.canonical',
    'entity.webform_submission.edit_form',
  ])) {
    $this->isAdminRoute = FALSE;
  }
  else {
    $this->isAdminRoute = preg_match('/^(webform\\.|^entity\\.([^.]+\\.)?webform)/', $route_name) ? TRUE : FALSE;
  }
  return $this->isAdminRoute;
}