You are here

public function PanelizerDefaultSelect::getCancelUrl in Panelizer 8.5

Same name and namespace in other branches
  1. 8.3 src/Form/PanelizerDefaultSelect.php \Drupal\panelizer\Form\PanelizerDefaultSelect::getCancelUrl()
  2. 8.4 src/Form/PanelizerDefaultSelect.php \Drupal\panelizer\Form\PanelizerDefaultSelect::getCancelUrl()

Returns the route to go to if the user cancels the action.

Return value

\Drupal\Core\Url A URL object.

Overrides ConfirmFormInterface::getCancelUrl

1 call to PanelizerDefaultSelect::getCancelUrl()
PanelizerDefaultSelect::submitForm in src/Form/PanelizerDefaultSelect.php
Form submission handler.

File

src/Form/PanelizerDefaultSelect.php, line 90

Class

PanelizerDefaultSelect

Namespace

Drupal\panelizer\Form

Code

public function getCancelUrl() {
  $bundle_entity_type = \Drupal::entityTypeManager()
    ->getDefinition($this->entityTypeId)
    ->getBundleEntityType();
  if ($this->viewMode == 'default') {
    $route = "entity.entity_view_display.{$this->entityTypeId}.default";
    $arguments = [
      $bundle_entity_type => $this->bundle,
    ];
  }
  else {
    $route = "entity.entity_view_display.{$this->entityTypeId}.view_mode";
    $arguments = [
      $bundle_entity_type => $this->bundle,
      'view_mode_name' => $this->viewMode,
    ];
  }
  return new Url($route, $arguments);
}