You are here

public function ViewRevisionsRequest::getBaseRouteName 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::getBaseRouteName()
1 call to ViewRevisionsRequest::getBaseRouteName()
ViewRevisionsRequest::getRouteName in modules/views_revisions/src/ViewsRevisionsRequest.php

File

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

Class

ViewRevisionsRequest
Handles view requests.

Namespace

Drupal\views_revisions

Code

public function getBaseRouteName(EntityInterface $view_entity, EntityInterface $source_entity = NULL) {
  if ($view_entity instanceof ViewSubmissionInterface) {
    $view = $view_entity
      ->getView();
  }
  elseif ($view_entity instanceof ViewInterface) {
    $view = $view_entity;
  }
  else {
    throw new \InvalidArgumentException('View entity');
  }
  if (static::isValidSourceEntity($view, $source_entity)) {
    return 'entity.' . $source_entity
      ->getEntityTypeId();
  }
  else {
    return 'entity';
  }
}