Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

\Drupal\Core\Form\ConfirmFormBase is the Drupal 8 equivalent of confirm_form(). See the change notice for that conversion here: confirm_form() deprecated in favor of \Drupal\Core\Form\ConfirmFormBase

Instead of specifying the path to return to when the "Cancel" button is clicked, you now specify the route name, and optionally, any route parameters or options.

use Drupal\Core\Url;

  public function getCancelUrl() {
    return new Url('system_admin', array(), array(
        'query' => array(
          'destination' => 'admin/config',
        ),
      ),
    );
  }
Impacts: 
Module developers

Comments

gribnif’s picture

The example uses getCancelUrl(), which I assume is incorrect based on the subject of this notice.

hgoto’s picture

Probably, since getCancelRoute() was renamed to getCancelUrl(), the sample code is correct. The title can be improved, maybe :)

#2305023: Rename getCancelRoute to getCancelUrl