You are here

public function FileManagementDeleteFileConfirmForm::getCancelUrl in File Management 8

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

Return value

\Drupal\Core\Url A URL object.

Overrides ConfirmFormInterface::getCancelUrl

File

src/Form/FileManagementDeleteFileConfirmForm.php, line 45

Class

FileManagementDeleteFileConfirmForm
Defines a confirmation form for deleting mymodule data.

Namespace

Drupal\file_management\Form

Code

public function getCancelUrl() {
  $route_overview = 'file_management_view.overview';
  $route_provider = \Drupal::service('router.route_provider');
  if (count($route_provider
    ->getRoutesByNames([
    $route_overview,
  ])) === 1) {
    return new Url($route_overview);
  }

  // Fallback to the standard files view if File Management View was not used.
  return Url::fromRoute('view.files.page_1');
}