Commit 59c3c975 authored by alexpott's avatar alexpott

Issue #2305023 by dawehner: Fixed Rename getCancelRoute to getCancelUrl.

parent 032757ab
......@@ -40,8 +40,8 @@ public static function buildCancelLink(ConfirmFormInterface $form, Request $requ
);
}
// Check for a route-based cancel link.
elseif ($route = $form->getCancelRoute()) {
$link = $route->toRenderArray();
elseif ($url = $form->getCancelUrl()) {
$link = $url->toRenderArray();
}
$link['#type'] = 'link';
......
......@@ -26,7 +26,7 @@ public function getQuestion();
* @return \Drupal\Core\Url
* A URL object.
*/
public function getCancelRoute();
public function getCancelUrl();
/**
* Returns additional text to display as a description.
......
......@@ -32,7 +32,7 @@ public function getConfirmText() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('action.admin');
}
......@@ -45,7 +45,7 @@ public function submit(array $form, array &$form_state) {
watchdog('user', 'Deleted action %aid (%action)', array('%aid' => $this->entity->id(), '%action' => $this->entity->label()));
drupal_set_message($this->t('Action %action was deleted', array('%action' => $this->entity->label())));
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -25,7 +25,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('aggregator.admin_overview');
}
......
......@@ -25,7 +25,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('aggregator.admin_overview');
}
......@@ -42,7 +42,7 @@ public function getConfirmText() {
public function submit(array $form, array &$form_state) {
$this->entity->deleteItems();
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -68,7 +68,7 @@ public function getConfirmText() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('ban.admin_page');
}
......@@ -92,7 +92,7 @@ public function submitForm(array &$form, array &$form_state) {
$this->ipManager->unbanIp($this->banIp);
watchdog('user', 'Deleted %ip', array('%ip' => $this->banIp));
drupal_set_message($this->t('The IP address %ip was deleted.', array('%ip' => $this->banIp)));
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -25,7 +25,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('block.admin_display');
}
......@@ -42,7 +42,7 @@ public function getConfirmText() {
public function submit(array $form, array &$form_state) {
$this->entity->delete();
drupal_set_message($this->t('The block %name has been removed.', array('%name' => $this->entity->label())));
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -25,7 +25,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('block.admin_display');
}
......
......@@ -53,7 +53,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('block_content.type_list');
}
......@@ -86,7 +86,7 @@ public function submit(array $form, array &$form_state) {
$this->entity->delete();
drupal_set_message(t('Custom block type %label has been deleted.', array('%label' => $this->entity->label())));
watchdog('block_content', 'Custom block type %label has been deleted.', array('%label' => $this->entity->label()), WATCHDOG_NOTICE);
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -96,7 +96,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return $this->node->urlInfo();
}
......@@ -108,7 +108,7 @@ public function submitForm(array &$form, array &$form_state) {
$this->bookManager->deleteFromBook($this->node->id());
drupal_set_message($this->t('The post has been removed from the book.'));
}
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -97,7 +97,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('comment.type_list');
}
......
......@@ -68,7 +68,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('comment.admin');
}
......@@ -123,7 +123,7 @@ public function submitForm(array &$form, array &$form_state) {
watchdog('content', 'Deleted @count comments.', array('@count' => $count));
drupal_set_message(format_plural($count, 'Deleted 1 comment.', 'Deleted @count comments.'));
}
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -24,7 +24,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
// Point to the entity of which this comment is a reply.
return $this->entity->get('entity_id')->entity->urlInfo();
}
......@@ -52,7 +52,7 @@ public function submit(array $form, array &$form_state) {
drupal_set_message($this->t('The comment and all its replies have been deleted.'));
watchdog('content', 'Deleted comment @cid and its replies.', array('@cid' => $this->entity->id()));
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -80,7 +80,7 @@ public function getFormID() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('config.import_single');
}
......
......@@ -32,7 +32,7 @@ public function getConfirmText() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('config_test.list_page');
}
......@@ -42,7 +42,7 @@ public function getCancelRoute() {
public function submit(array $form, array &$form_state) {
$this->entity->delete();
drupal_set_message(String::format('%label configuration has been deleted.', array('%label' => $this->entity->label())));
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -101,7 +101,7 @@ public function getConfirmText() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url($this->mapper->getOverviewRouteName(), $this->mapper->getOverviewRouteParameters());
}
......@@ -146,7 +146,7 @@ public function submitForm(array &$form, array &$form_state) {
drupal_set_message($this->t('@language translation of %label was deleted', array('%label' => $this->mapper->getTitle(), '@language' => $this->language->name)));
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -25,7 +25,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('contact.category_list');
}
......@@ -43,7 +43,7 @@ public function submit(array $form, array &$form_state) {
$this->entity->delete();
drupal_set_message($this->t('Category %label has been deleted.', array('%label' => $this->entity->label())));
watchdog('contact', 'Category %label has been deleted.', array('%label' => $this->entity->label()), WATCHDOG_NOTICE);
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -62,7 +62,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return $this->entity->urlInfo('drupal:content-translation-overview');
}
......@@ -82,7 +82,7 @@ public function submitForm(array &$form, array &$form_state) {
\Drupal::service('path.alias_storage')->delete($conditions);
}
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -60,7 +60,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('dblog.overview');
}
......@@ -71,7 +71,7 @@ public function submitForm(array &$form, array &$form_state) {
$_SESSION['dblog_overview_filter'] = array();
$this->connection->delete('watchdog')->execute();
drupal_set_message($this->t('Database log cleared.'));
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -18,7 +18,7 @@ class EntityDisplayModeDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('entity.' . $this->entity->getEntityTypeId() . '_list');
}
......@@ -55,7 +55,7 @@ public function submit(array $form, array &$form_state) {
drupal_set_message(t('Deleted the %label @entity-type.', array('%label' => $this->entity->label(), '@entity-type' => $entity_type->getLowercaseLabel())));
$this->entity->delete();
\Drupal::entityManager()->clearCachedFieldDefinitions();
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -60,7 +60,7 @@ public function getConfirmText() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return FieldUI::getOverviewRouteInfo($this->entity->entity_type, $this->entity->bundle);
}
......@@ -80,7 +80,7 @@ public function submit(array $form, array &$form_state) {
drupal_set_message($this->t('There was a problem removing the %field from the %type content type.', array('%field' => $this->entity->label(), '%type' => $bundle_label)), 'error');
}
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
// Fields are purged on cron. However field module prevents disabling modules
// when field types they provided are used in a field until it is fully
......
......@@ -25,7 +25,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('filter.admin_overview');
}
......@@ -50,7 +50,7 @@ public function submit(array $form, array &$form_state) {
$this->entity->disable()->save();
drupal_set_message($this->t('Disabled text format %format.', array('%format' => $this->entity->label())));
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -40,7 +40,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('forum.overview');
}
......@@ -67,7 +67,7 @@ public function submitForm(array &$form, array &$form_state) {
$this->taxonomyTerm->delete();
drupal_set_message($this->t('The forum %label and all sub-forums have been deleted.', array('%label' => $this->taxonomyTerm->label())));
watchdog('forum', 'forum: deleted %label and all its sub-forums.', array('%label' => $this->taxonomyTerm->label()), WATCHDOG_NOTICE);
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -46,7 +46,7 @@ public function getConfirmText() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return $this->imageStyle->urlInfo('edit-form');
}
......
......@@ -32,7 +32,7 @@ public function getConfirmText() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('image.style_list');
}
......@@ -65,7 +65,7 @@ public function submit(array $form, array &$form_state) {
$this->entity->set('replacementID', $form_state['values']['replacement']);
$this->entity->delete();
drupal_set_message($this->t('Style %name was deleted.', array('%name' => $this->entity->label())));
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -39,7 +39,7 @@ public function getConfirmText() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('image.style_list');
}
......@@ -49,7 +49,7 @@ public function getCancelRoute() {
public function submit(array $form, array &$form_state) {
$this->entity->flush();
drupal_set_message($this->t('The image style %name has been flushed.', array('%name' => $this->entity->label())));
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -56,7 +56,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('language.admin_overview');
}
......@@ -114,7 +114,7 @@ public function submit(array $form, array &$form_state) {
drupal_set_message($this->t('The %language (%langcode) language has been removed.', array('%language' => $this->entity->label(), '%langcode' => $this->entity->id())));
}
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -8,6 +8,7 @@
namespace Drupal\language\Form;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\Request;
/**
......@@ -32,7 +33,8 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('language.negotiation_browser');
}
/**
......@@ -50,8 +52,6 @@ public function buildForm(array $form, array &$form_state, $browser_langcode = N
$form = parent::buildForm($form, $form_state);
// @todo Convert to getCancelRoute() after http://drupal.org/node/2082071.
$form['actions']['cancel']['#href'] = 'admin/config/regional/language/detection/browser';
return $form;
}
......
......@@ -58,7 +58,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('menu_ui.menu_edit', array('menu' => $this->entity->getMenuName()));
}
......
......@@ -65,7 +65,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return $this->entity->urlInfo('edit-form');
}
......
......@@ -25,7 +25,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('menu_ui.menu_edit', array(
'menu' => $this->entity->menu_name,
));
......@@ -39,7 +39,7 @@ public function submit(array $form, array &$form_state) {
$t_args = array('%title' => $this->entity->link_title);
drupal_set_message(t('The menu link %title has been deleted.', $t_args));
watchdog('menu', 'Deleted menu link %title.', $t_args, WATCHDOG_NOTICE);
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -25,7 +25,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('menu_ui.menu_edit', array(
'menu' => $this->entity->menu_name,
));
......@@ -51,7 +51,7 @@ public function getConfirmText() {
public function submit(array $form, array &$form_state) {
$this->entity = $this->entity->reset();
drupal_set_message(t('The menu link was reset to its default settings.'));
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -9,6 +9,7 @@
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Url;
use Drupal\Component\Utility\String;
use Drupal\user\TempStoreFactory;
use Symfony\Component\HttpFoundation\RedirectResponse;
......@@ -80,7 +81,8 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('system.admin_content');
}
/**
......@@ -107,8 +109,6 @@ public function buildForm(array $form, array &$form_state) {
);
$form = parent::buildForm($form, $form_state);
// @todo Convert to getCancelRoute() after http://drupal.org/node/2021161.
$form['actions']['cancel']['#href'] = 'admin/content';
return $form;
}
......
......@@ -57,7 +57,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return $this->entity->urlInfo();
}
......
......@@ -10,6 +10,7 @@
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Url;
use Drupal\node\NodeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -91,7 +92,8 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('node.revision_overview', array('node' => $this->revision->id()));
}
/**
......@@ -108,8 +110,6 @@ public function buildForm(array $form, array &$form_state, $node_revision = NULL
$this->revision = $this->nodeStorage->loadRevision($node_revision);
$form = parent::buildForm($form, $form_state);
// @todo Convert to getCancelRoute() after http://drupal.org/node/1863906.
$form['actions']['cancel']['#href'] = 'node/' . $this->revision->id() . '/revisions';
return $form;
}
......
......@@ -9,6 +9,7 @@
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Url;
use Drupal\node\NodeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -67,7 +68,8 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('node.revision_overview', array('node' => $this->revision->id()));
}
/**
......@@ -91,8 +93,6 @@ public function buildForm(array $form, array &$form_state, $node_revision = NULL
$this->revision = $this->nodeStorage->loadRevision($node_revision);
$form = parent::buildForm($form, $form_state);
// @todo Convert to getCancelRoute() after http://drupal.org/node/1863906.
$form['actions']['cancel']['#href'] = 'node/' . $this->revision->id() . '/revisions';
return $form;
}
......
......@@ -53,7 +53,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('node.overview_types');
}
......@@ -88,7 +88,7 @@ public function submit(array $form, array &$form_state) {
drupal_set_message(t('The content type %name has been deleted.', $t_args));
watchdog('node', 'Deleted content type %name.', $t_args, WATCHDOG_NOTICE);
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -29,7 +29,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('system.status');
}
......@@ -52,7 +52,7 @@ public function getDescription() {
*/
public function submitForm(array &$form, array &$form_state) {
node_access_rebuild(TRUE);
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -9,6 +9,7 @@
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Path\AliasStorageInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
......@@ -66,7 +67,8 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('path.admin_overview');
}
/**
......@@ -77,8 +79,6 @@ public function buildForm(array $form, array &$form_state, $pid = NULL) {
$form = parent::buildForm($form, $form_state);
// @todo Convert to getCancelRoute() after http://drupal.org/node/1987802.
$form['actions']['cancel']['#href'] = 'admin/config/search/path';
return $form;
}
......@@ -90,4 +90,5 @@ public function submitForm(array &$form, array &$form_state) {
$form_state['redirect'] = 'admin/config/search/path';
}
}
......@@ -22,7 +22,7 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('responsive_image.mapping_page');
}
......@@ -40,7 +40,7 @@ public function submit(array $form, array &$form_state) {
$this->entity->delete();
drupal_set_message($this->t('Responsive image mapping %label has been deleted.', array('%label' => $this->entity->label())));
watchdog('responsive_image', 'Responsive image mapping %label has been deleted.', array('%label' => $this->entity->label()), WATCHDOG_NOTICE);
$form_state['redirect_route'] = $this->getCancelRoute();
$form_state['redirect_route'] = $this->getCancelUrl();
}
}
......@@ -53,7 +53,7 @@ public function getCancelText() {
/**
* {@inheritdoc}
*/
public function getCancelRoute() {
public function getCancelUrl() {
return new Url('search.settings');
}