summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2013-11-14 05:31:49 (GMT)
committerwebchick2013-11-14 05:31:49 (GMT)
commit744309f9f2d885559b45b06885c77352b506b2a9 (patch)
tree9ec1fa62e49150884ca1183afcfa232f36d8947b
parent4217221f94b1c01f5d3cecc18360952e42ba4bc8 (diff)
Issue #2125253 by tim.plunkett: Convert ()['redirect'] to ()['redirect_route()'].
-rw-r--r--core/lib/Drupal/Core/Form/FormBuilder.php3
-rw-r--r--core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php12
-rw-r--r--core/modules/aggregator/lib/Drupal/aggregator/Form/CategoryAdminForm.php12
-rw-r--r--core/modules/aggregator/lib/Drupal/aggregator/Form/CategoryDeleteForm.php4
-rw-r--r--core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDeleteForm.php4
-rw-r--r--core/modules/aggregator/lib/Drupal/aggregator/Form/FeedItemsRemoveForm.php2
-rw-r--r--core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php2
-rw-r--r--core/modules/ban/lib/Drupal/ban/Form/BanAdmin.php2
-rw-r--r--core/modules/ban/lib/Drupal/ban/Form/BanDelete.php2
-rw-r--r--core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php27
-rw-r--r--core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php10
-rw-r--r--core/modules/block/custom_block/lib/Drupal/custom_block/Form/CustomBlockDeleteForm.php2
-rw-r--r--core/modules/block/custom_block/lib/Drupal/custom_block/Form/CustomBlockTypeDeleteForm.php2
-rw-r--r--core/modules/block/lib/Drupal/block/BlockFormController.php19
-rw-r--r--core/modules/block/lib/Drupal/block/Form/BlockDeleteForm.php2
-rw-r--r--core/modules/book/book.pages.inc19
-rw-r--r--core/modules/book/lib/Drupal/book/Form/BookOutlineForm.php21
-rw-r--r--core/modules/comment/comment.admin.inc2
-rw-r--r--core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php4
-rw-r--r--core/modules/config/lib/Drupal/config/Form/ConfigExportForm.php2
-rw-r--r--core/modules/config/lib/Drupal/config/Form/ConfigImportForm.php2
-rw-r--r--core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php10
-rw-r--r--core/modules/config/tests/config_test/lib/Drupal/config_test/Form/ConfigTestDeleteForm.php2
-rw-r--r--core/modules/contact/lib/Drupal/contact/CategoryFormController.php7
-rw-r--r--core/modules/contact/lib/Drupal/contact/Form/CategoryDeleteForm.php2
-rw-r--r--core/modules/contact/lib/Drupal/contact/MessageFormController.php2
-rw-r--r--core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeDeleteForm.php3
-rw-r--r--core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeEditForm.php9
-rw-r--r--core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeFormBase.php3
-rw-r--r--core/modules/field_ui/field_ui.module8
-rw-r--r--core/modules/field_ui/lib/Drupal/field_ui/Form/FieldDeleteForm.php8
-rw-r--r--core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php14
-rw-r--r--core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php37
-rw-r--r--core/modules/filter/lib/Drupal/filter/FilterFormatFormControllerBase.php2
-rw-r--r--core/modules/filter/lib/Drupal/filter/Form/FilterDisableForm.php2
-rw-r--r--core/modules/forum/lib/Drupal/forum/Form/DeleteForm.php2
-rw-r--r--core/modules/forum/lib/Drupal/forum/Form/ForumFormController.php14
-rw-r--r--core/modules/image/lib/Drupal/image/Form/ImageEffectDeleteForm.php7
-rw-r--r--core/modules/image/lib/Drupal/image/Form/ImageEffectFormBase.php7
-rw-r--r--core/modules/image/lib/Drupal/image/Form/ImageStyleDeleteForm.php2
-rw-r--r--core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php12
-rw-r--r--core/modules/image/lib/Drupal/image/Form/ImageStyleFlushForm.php2
-rw-r--r--core/modules/image/lib/Drupal/image/Form/ImageStyleFormBase.php7
-rw-r--r--core/modules/language/language.admin.inc2
-rw-r--r--core/modules/language/lib/Drupal/language/Form/LanguageAddForm.php2
-rw-r--r--core/modules/language/lib/Drupal/language/Form/LanguageDeleteForm.php2
-rw-r--r--core/modules/language/lib/Drupal/language/Form/LanguageEditForm.php2
-rw-r--r--core/modules/language/lib/Drupal/language/Form/NegotiationBrowserDeleteForm.php2
-rw-r--r--core/modules/language/lib/Drupal/language/Form/NegotiationBrowserForm.php2
-rw-r--r--core/modules/language/lib/Drupal/language/Form/NegotiationSessionForm.php2
-rw-r--r--core/modules/language/lib/Drupal/language/Form/NegotiationUrlForm.php2
-rw-r--r--core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php7
-rw-r--r--core/modules/locale/lib/Drupal/locale/Form/TranslateFilterForm.php4
-rw-r--r--core/modules/locale/locale.bulk.inc2
-rw-r--r--core/modules/menu/lib/Drupal/menu/Form/MenuDeleteForm.php2
-rw-r--r--core/modules/menu/lib/Drupal/menu/Form/MenuLinkDeleteForm.php7
-rw-r--r--core/modules/menu/lib/Drupal/menu/Form/MenuLinkResetForm.php7
-rw-r--r--core/modules/menu/lib/Drupal/menu/MenuFormController.php14
-rw-r--r--core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php14
-rw-r--r--core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php2
-rw-r--r--core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php2
-rw-r--r--core/modules/node/lib/Drupal/node/Form/NodeRevisionDeleteForm.php9
-rw-r--r--core/modules/node/lib/Drupal/node/Form/NodeRevisionRevertForm.php7
-rw-r--r--core/modules/node/lib/Drupal/node/Form/NodeTypeDeleteConfirm.php2
-rw-r--r--core/modules/node/lib/Drupal/node/Form/RebuildPermissionsForm.php2
-rw-r--r--core/modules/node/lib/Drupal/node/NodeFormController.php23
-rw-r--r--core/modules/node/lib/Drupal/node/NodeTypeFormController.php9
-rw-r--r--core/modules/picture/lib/Drupal/picture/Form/PictureMappingDeleteForm.php2
-rw-r--r--core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php10
-rw-r--r--core/modules/search/lib/Drupal/search/Form/ReindexConfirm.php3
-rw-r--r--core/modules/search/lib/Drupal/search/Form/SearchBlockForm.php7
-rw-r--r--core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php2
-rw-r--r--core/modules/search/search.module57
-rw-r--r--core/modules/shortcut/lib/Drupal/shortcut/Form/LinkDelete.php7
-rw-r--r--core/modules/shortcut/lib/Drupal/shortcut/Form/ShortcutSetDeleteForm.php2
-rw-r--r--core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetFormController.php15
-rw-r--r--core/modules/shortcut/shortcut.admin.inc21
-rw-r--r--core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php4
-rw-r--r--core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php7
-rw-r--r--core/modules/system/lib/Drupal/system/Form/DateFormatDeleteForm.php2
-rw-r--r--core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php2
-rw-r--r--core/modules/system/lib/Drupal/system/Form/ModulesListConfirmForm.php2
-rw-r--r--core/modules/system/lib/Drupal/system/Form/ModulesListForm.php2
-rw-r--r--core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php2
-rw-r--r--core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php4
-rw-r--r--core/modules/system/tests/modules/ajax_test/ajax_test.module2
-rw-r--r--core/modules/system/tests/modules/batch_test/batch_test.module12
-rw-r--r--core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php10
-rw-r--r--core/modules/system/tests/modules/form_test/form_test.module2
-rw-r--r--core/modules/system/tests/modules/form_test/lib/Drupal/form_test/ConfirmFormTestForm.php2
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php5
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Form/TermDeleteForm.php2
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyDeleteForm.php2
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyResetForm.php5
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php6
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php12
-rw-r--r--core/modules/user/lib/Drupal/user/Form/UserCancelForm.php7
-rw-r--r--core/modules/user/lib/Drupal/user/Form/UserLoginForm.php5
-rw-r--r--core/modules/user/lib/Drupal/user/Form/UserMultipleCancelConfirm.php2
-rw-r--r--core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php2
-rw-r--r--core/modules/user/lib/Drupal/user/Form/UserRoleDelete.php2
-rw-r--r--core/modules/user/lib/Drupal/user/ProfileFormController.php6
-rw-r--r--core/modules/user/lib/Drupal/user/RegisterFormController.php6
-rw-r--r--core/modules/user/lib/Drupal/user/RoleFormController.php7
-rw-r--r--core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Analyze.php5
-rw-r--r--core/modules/views_ui/lib/Drupal/views_ui/Form/BreakLockForm.php5
-rw-r--r--core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php9
-rw-r--r--core/modules/views_ui/lib/Drupal/views_ui/ViewDeleteFormController.php2
-rw-r--r--core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php42
-rw-r--r--core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php5
110 files changed, 494 insertions, 268 deletions
diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php
index 38bfab7..cbaf908 100644
--- a/core/lib/Drupal/Core/Form/FormBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -419,6 +419,7 @@ class FormBuilder implements FormBuilderInterface {
'rebuild',
'rebuild_info',
'redirect',
+ 'redirect_route',
'no_redirect',
'temporary',
// Internal properties defined by form processing.
@@ -640,7 +641,7 @@ class FormBuilder implements FormBuilderInterface {
$batch['form_state'] = $form_state;
}
else {
- $batch['form_state'] = array_intersect_key($form_state, array_flip(array('programmed', 'rebuild', 'storage', 'no_redirect', 'redirect')));
+ $batch['form_state'] = array_intersect_key($form_state, array_flip(array('programmed', 'rebuild', 'storage', 'no_redirect', 'redirect', 'redirect_route')));
}
$batch['progressive'] = !$form_state['programmed'];
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php b/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php
index d4761f5..899bb40 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php
@@ -146,10 +146,13 @@ class FeedFormController extends ContentEntityFormController {
if ($insert) {
drupal_set_message($this->t('The feed %feed has been updated.', array('%feed' => $feed->label())));
if (arg(0) == 'admin') {
- $form_state['redirect'] = 'admin/config/services/aggregator';
+ $form_state['redirect_route']['route_name'] = 'aggregator.admin_overview';
}
else {
- $form_state['redirect'] = 'aggregator/sources/' . $feed->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'aggregator.feed_view',
+ 'route_parameters' => array('aggregator_feed' => $feed->id()),
+ );
}
}
else {
@@ -162,7 +165,10 @@ class FeedFormController extends ContentEntityFormController {
* {@inheritdoc}
*/
public function delete(array $form, array &$form_state) {
- $form_state['redirect'] = 'admin/config/services/aggregator/delete/feed/' . $this->entity->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'aggregator.feed_delete',
+ 'route_parameters' => array('aggregator_feed' => $this->entity->id()),
+ );
}
}
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Form/CategoryAdminForm.php b/core/modules/aggregator/lib/Drupal/aggregator/Form/CategoryAdminForm.php
index 68372c9..a24a420 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Form/CategoryAdminForm.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Form/CategoryAdminForm.php
@@ -144,7 +144,10 @@ class CategoryAdminForm extends FormBase {
// Redirect to a confirm delete form.
if ($form_state['values']['op'] == $this->t('Delete')) {
$cid = $form_state['values']['cid'];
- $form_state['redirect'] = 'admin/config/services/aggregator/delete/category/' . $cid;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'aggregator.category_delete',
+ 'route_parameters' => array('cid' => $cid),
+ );
return;
}
@@ -154,10 +157,13 @@ class CategoryAdminForm extends FormBase {
$this->categoryStorageController->update((object) $form_state['values']);
drupal_set_message($this->t('The category %category has been updated.', array('%category' => $title)));
if (preg_match('/^\/admin/', $this->getRequest()->getPathInfo())) {
- $form_state['redirect'] = 'admin/config/services/aggregator/';
+ $form_state['redirect_route']['route_name'] = 'aggregator.admin_overview';
}
else {
- $form_state['redirect'] = 'aggregator/categories/' . $cid;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'aggregator.category_view',
+ 'route_parameters' => array('cid' => $cid),
+ );
}
$this->updateMenuLink('update', $link_path . $cid, $title);
return;
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Form/CategoryDeleteForm.php b/core/modules/aggregator/lib/Drupal/aggregator/Form/CategoryDeleteForm.php
index 43c0ffa..0335e04 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Form/CategoryDeleteForm.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Form/CategoryDeleteForm.php
@@ -149,10 +149,10 @@ class CategoryDeleteForm extends ConfirmFormBase implements ContainerInjectionIn
watchdog('aggregator', 'Category %category deleted.', array('%category' => $title));
drupal_set_message($this->t('The category %category has been deleted.', array('%category' => $title)));
if (preg_match('/^\/admin/', $this->getRequest()->getPathInfo())) {
- $form_state['redirect'] = 'admin/config/services/aggregator/';
+ $form_state['redirect_route']['route_name'] = 'aggregator.admin_overview';
}
else {
- $form_state['redirect'] = 'aggregator';
+ $form_state['redirect_route']['route_name'] = 'aggregator.page_last';
}
$this->updateMenuLink('delete', 'aggregator/categories/' . $cid, $title);
}
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDeleteForm.php b/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDeleteForm.php
index adad1ee..7cc3827 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDeleteForm.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDeleteForm.php
@@ -45,10 +45,10 @@ class FeedDeleteForm extends ContentEntityConfirmFormBase {
watchdog('aggregator', 'Feed %feed deleted.', array('%feed' => $this->entity->label()));
drupal_set_message($this->t('The feed %feed has been deleted.', array('%feed' => $this->entity->label())));
if (arg(0) == 'admin') {
- $form_state['redirect'] = 'admin/config/services/aggregator';
+ $form_state['redirect_route']['route_name'] = 'aggregator.admin_overview';
}
else {
- $form_state['redirect'] = 'aggregator/sources';
+ $form_state['redirect_route']['route_name'] = 'aggregator.sources';
}
}
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedItemsRemoveForm.php b/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedItemsRemoveForm.php
index 54b7d5a..05168c5 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedItemsRemoveForm.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedItemsRemoveForm.php
@@ -43,7 +43,7 @@ class FeedItemsRemoveForm extends ContentEntityConfirmFormBase {
public function submit(array $form, array &$form_state) {
$this->entity->removeItems();
- $form_state['redirect'] = 'admin/config/services/aggregator';
+ $form_state['redirect_route']['route_name'] = 'aggregator.admin_overview';
}
}
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php b/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php
index abf1cad..748574f 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php
@@ -213,7 +213,7 @@ class OpmlFeedAdd extends FormBase {
$new_feed->save();
}
- $form_state['redirect'] = 'admin/config/services/aggregator';
+ $form_state['redirect_route']['route_name'] = 'aggregator.admin_overview';
}
/**
diff --git a/core/modules/ban/lib/Drupal/ban/Form/BanAdmin.php b/core/modules/ban/lib/Drupal/ban/Form/BanAdmin.php
index f15f734..8461d67 100644
--- a/core/modules/ban/lib/Drupal/ban/Form/BanAdmin.php
+++ b/core/modules/ban/lib/Drupal/ban/Form/BanAdmin.php
@@ -121,7 +121,7 @@ class BanAdmin extends FormBase {
$ip = trim($form_state['values']['ip']);
$this->ipManager->banIp($ip);
drupal_set_message($this->t('The IP address %ip has been banned.', array('%ip' => $ip)));
- $form_state['redirect'] = 'admin/config/people/ban';
+ $form_state['redirect_route']['route_name'] = 'ban.admin_page';
}
}
diff --git a/core/modules/ban/lib/Drupal/ban/Form/BanDelete.php b/core/modules/ban/lib/Drupal/ban/Form/BanDelete.php
index 43b5359..e8fce2e 100644
--- a/core/modules/ban/lib/Drupal/ban/Form/BanDelete.php
+++ b/core/modules/ban/lib/Drupal/ban/Form/BanDelete.php
@@ -93,7 +93,7 @@ class BanDelete extends ConfirmFormBase {
$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'] = 'admin/config/people/ban';
+ $form_state['redirect_route']['route_name'] = 'ban.admin_page';
}
}
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
index fb818fc..ffa7d47 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
@@ -183,15 +183,19 @@ class CustomBlockFormController extends ContentEntityFormController {
$form_state['values']['id'] = $block->id->value;
$form_state['id'] = $block->id->value;
if ($insert) {
- if ($theme = $block->getTheme()) {
- $form_state['redirect'] = 'admin/structure/block/add/custom_block:' . $block->uuid->value . '/' . $theme;
- }
- else {
- $form_state['redirect'] = 'admin/structure/block/add/custom_block:' . $block->uuid->value . '/' . \Drupal::config('system.theme')->get('default');
+ if (!$theme = $block->getTheme()) {
+ $theme = $this->config('system.theme')->get('default');
}
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'block.admin_add',
+ 'route_parameters' => array(
+ 'plugin_id' => 'custom_block:' . $block->uuid(),
+ 'theme' => $theme,
+ ),
+ );
}
else {
- $form_state['redirect'] = 'admin/structure/block/custom-blocks';
+ $form_state['redirect_route']['route_name'] = 'custom_block.list';
}
}
else {
@@ -215,8 +219,15 @@ class CustomBlockFormController extends ContentEntityFormController {
$destination = drupal_get_destination();
$query->remove('destination');
}
- $block = $this->buildEntity($form, $form_state);
- $form_state['redirect'] = array('block/' . $block->id() . '/delete', array('query' => $destination));
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'custom_block.delete',
+ 'route_parameters' => array(
+ 'custom_block' => $this->entity->id(),
+ ),
+ 'options' => array(
+ 'query' => $destination,
+ ),
+ );
}
/**
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php
index a3e143f..15cd8f8 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php
@@ -101,15 +101,19 @@ class CustomBlockTypeFormController extends EntityFormController {
watchdog('custom_block', 'Custom block type %label has been added.', array('%label' => $block_type->label()), WATCHDOG_NOTICE, l(t('Edit'), $uri['path'] . '/edit'));
}
- $form_state['redirect'] = 'admin/structure/block/custom-blocks/types';
+ $form_state['redirect_route']['route_name'] = 'custom_block.type_list';
}
/**
* Overrides \Drupal\Core\Entity\EntityFormController::delete().
*/
public function delete(array $form, array &$form_state) {
- $block_type = $this->entity;
- $form_state['redirect'] = 'admin/structure/block/custom-blocks/manage/' . $block_type->id() . '/delete';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'custom_block.type_delete',
+ 'route_parameters' => array(
+ 'custom_block_type' => $this->entity->id(),
+ ),
+ );
}
}
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Form/CustomBlockDeleteForm.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Form/CustomBlockDeleteForm.php
index 012a9b0..96ee5f0 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Form/CustomBlockDeleteForm.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Form/CustomBlockDeleteForm.php
@@ -60,7 +60,7 @@ class CustomBlockDeleteForm extends ContentEntityConfirmFormBase {
$this->entity->delete();
drupal_set_message($this->t('Custom block %label has been deleted.', array('%label' => $this->entity->label())));
watchdog('custom_block', 'Custom block %label has been deleted.', array('%label' => $this->entity->label()), WATCHDOG_NOTICE);
- $form_state['redirect'] = 'admin/structure/block/custom-blocks';
+ $form_state['redirect_route']['route_name'] = 'custom_block.list';
}
}
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Form/CustomBlockTypeDeleteForm.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Form/CustomBlockTypeDeleteForm.php
index 01433ae..e065e65 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Form/CustomBlockTypeDeleteForm.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Form/CustomBlockTypeDeleteForm.php
@@ -85,7 +85,7 @@ class CustomBlockTypeDeleteForm extends EntityConfirmFormBase {
*/
public function submit(array $form, array &$form_state) {
$this->entity->delete();
- $form_state['redirect'] = 'admin/structure/block/custom-blocks/types';
+ $form_state['redirect_route']['route_name'] = 'custom_block.type_list';
drupal_set_message(t('Custom block type %label has been deleted.', array('%label' => $this->entity->label())));
watchdog('custom_block', 'Custom block type %label has been deleted.', array('%label' => $this->entity->label()), WATCHDOG_NOTICE);
}
diff --git a/core/modules/block/lib/Drupal/block/BlockFormController.php b/core/modules/block/lib/Drupal/block/BlockFormController.php
index 8491238..6d88f11 100644
--- a/core/modules/block/lib/Drupal/block/BlockFormController.php
+++ b/core/modules/block/lib/Drupal/block/BlockFormController.php
@@ -326,9 +326,15 @@ class BlockFormController extends EntityFormController {
// Invalidate the content cache and redirect to the block listing,
// because we need to remove cached block contents for each cache backend.
Cache::invalidateTags(array('content' => TRUE));
- $form_state['redirect'] = array('admin/structure/block/list/' . $form_state['values']['theme'], array(
- 'query' => array('block-placement' => drupal_html_class($this->entity->id())),
- ));
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'block.admin_display_theme',
+ 'route_parameters' => array(
+ 'theme' => $form_state['values']['theme'],
+ ),
+ 'options' => array(
+ 'query' => array('block-placement' => drupal_html_class($this->entity->id()))
+ ),
+ );
}
/**
@@ -336,7 +342,12 @@ class BlockFormController extends EntityFormController {
*/
public function delete(array $form, array &$form_state) {
parent::delete($form, $form_state);
- $form_state['redirect'] = 'admin/structure/block/manage/' . $this->entity->id() . '/delete';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'block.admin_block_delete',
+ 'route_parameters' => array(
+ 'block' => $this->entity->id(),
+ ),
+ );
}
/**
diff --git a/core/modules/block/lib/Drupal/block/Form/BlockDeleteForm.php b/core/modules/block/lib/Drupal/block/Form/BlockDeleteForm.php
index ce381cc..20c1e7e 100644
--- a/core/modules/block/lib/Drupal/block/Form/BlockDeleteForm.php
+++ b/core/modules/block/lib/Drupal/block/Form/BlockDeleteForm.php
@@ -43,7 +43,7 @@ class BlockDeleteForm extends EntityConfirmFormBase {
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'] = 'admin/structure/block';
+ $form_state['redirect_route']['route_name'] = 'block.admin_display';
}
}
diff --git a/core/modules/book/book.pages.inc b/core/modules/book/book.pages.inc
index 5e7b4de..d01636c 100644
--- a/core/modules/book/book.pages.inc
+++ b/core/modules/book/book.pages.inc
@@ -9,18 +9,6 @@ use Drupal\Core\Entity\EntityInterface;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-
-/**
- * Form submission handler for book_outline_form().
- *
- * Redirects to removal confirmation form.
- *
- * @see book_outline_form_submit()
- */
-function book_remove_button_submit($form, &$form_state) {
- $form_state['redirect'] = 'node/' . $form['#node']->id() . '/outline/remove';
-}
-
/**
* Form constructor to confirm removal of a node from a book.
*
@@ -59,5 +47,10 @@ function book_remove_form_submit($form, &$form_state) {
->execute();
drupal_set_message(t('The post has been removed from the book.'));
}
- $form_state['redirect'] = 'node/' . $node->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'node.view',
+ 'route_parameters' => array(
+ 'node' => $node->id(),
+ ),
+ );
}
diff --git a/core/modules/book/lib/Drupal/book/Form/BookOutlineForm.php b/core/modules/book/lib/Drupal/book/Form/BookOutlineForm.php
index 61ff1fc..5364d93 100644
--- a/core/modules/book/lib/Drupal/book/Form/BookOutlineForm.php
+++ b/core/modules/book/lib/Drupal/book/Form/BookOutlineForm.php
@@ -101,7 +101,12 @@ class BookOutlineForm extends ContentEntityFormController {
* @see book_remove_button_submit()
*/
public function submit(array $form, array &$form_state) {
- $form_state['redirect'] = 'node/' . $this->entity->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'node.view',
+ 'route_parameters' => array(
+ 'node' => $this->entity->id(),
+ ),
+ );
$book_link = $form_state['values']['book'];
if (!$book_link['bid']) {
drupal_set_message($this->t('No changes were made'));
@@ -114,7 +119,12 @@ class BookOutlineForm extends ContentEntityFormController {
if ($this->entity->book['parent_mismatch']) {
// This will usually only happen when JS is disabled.
drupal_set_message($this->t('The post has been added to the selected book. You may now position it relative to other pages.'));
- $form_state['redirect'] = 'node/' . $this->entity->id() . '/outline';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'book.outline',
+ 'route_parameters' => array(
+ 'node' => $this->entity->id(),
+ ),
+ );
}
else {
drupal_set_message($this->t('The book outline has been updated.'));
@@ -129,7 +139,12 @@ class BookOutlineForm extends ContentEntityFormController {
* {@inheritdoc}
*/
public function delete(array $form, array &$form_state) {
- $form_state['redirect'] = 'node/' . $this->entity->id() . '/outline/remove';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'book.remove',
+ 'route_parameters' => array(
+ 'node' => $this->entity->id(),
+ ),
+ );
}
}
diff --git a/core/modules/comment/comment.admin.inc b/core/modules/comment/comment.admin.inc
index f17fa59..c1726be 100644
--- a/core/modules/comment/comment.admin.inc
+++ b/core/modules/comment/comment.admin.inc
@@ -225,6 +225,6 @@ function comment_admin_overview_submit($form, &$form_state) {
}
}
drupal_set_message(t('The update has been performed.'));
- $form_state['redirect'] = 'admin/content/comment';
+ $form_state['redirect_route']['route_name'] = 'comment.admin';
cache_invalidate_tags(array('content' => TRUE));
}
diff --git a/core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php b/core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php
index 97884ca..1967277 100644
--- a/core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php
+++ b/core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php
@@ -107,7 +107,7 @@ class ConfirmDeleteMultiple extends ConfirmFormBase implements ContainerInjectio
if (!$comment_counter) {
drupal_set_message($this->t('There do not appear to be any comments to delete, or your selected comment was deleted by another administrator.'));
- $form_state['redirect'] = 'admin/content/comment';
+ $form_state['redirect_route']['route_name'] = 'comment.admin';
}
$form = parent::buildForm($form, $form_state);
@@ -128,7 +128,7 @@ class ConfirmDeleteMultiple extends ConfirmFormBase implements ContainerInjectio
watchdog('content', 'Deleted @count comments.', array('@count' => $count));
drupal_set_message(format_plural($count, 'Deleted 1 comment.', 'Deleted @count comments.'));
}
- $form_state['redirect'] = 'admin/content/comment';
+ $form_state['redirect_route']['route_name'] = 'comment.admin';
}
}
diff --git a/core/modules/config/lib/Drupal/config/Form/ConfigExportForm.php b/core/modules/config/lib/Drupal/config/Form/ConfigExportForm.php
index 7f41e50..c351818 100644
--- a/core/modules/config/lib/Drupal/config/Form/ConfigExportForm.php
+++ b/core/modules/config/lib/Drupal/config/Form/ConfigExportForm.php
@@ -39,7 +39,7 @@ class ConfigExportForm extends FormBase {
* {@inheritdoc}
*/
public function submitForm(array &$form, array &$form_state) {
- $form_state['redirect'] = 'admin/config/development/configuration/full/export-download';
+ $form_state['redirect_route']['route_name'] = 'config.export_download';
}
}
diff --git a/core/modules/config/lib/Drupal/config/Form/ConfigImportForm.php b/core/modules/config/lib/Drupal/config/Form/ConfigImportForm.php
index 2d5c4a8..c6a9304 100644
--- a/core/modules/config/lib/Drupal/config/Form/ConfigImportForm.php
+++ b/core/modules/config/lib/Drupal/config/Form/ConfigImportForm.php
@@ -96,7 +96,7 @@ class ConfigImportForm extends FormBase {
}
$archiver->extractList($files, config_get_config_directory(CONFIG_STAGING_DIRECTORY));
drupal_set_message($this->t('Your configuration files were successfully uploaded, ready for import.'));
- $form_state['redirect'] = 'admin/config/development/configuration';
+ $form_state['redirect_route']['route_name'] = 'config.sync';
}
catch (\Exception $e) {
form_set_error('import_tarball', $this->t('Could not extract the contents of the tar file. The error message is <em>@message</em>', array('@message' => $e->getMessage())));
diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php
index 119774b..514311b 100644
--- a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php
+++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php
@@ -79,15 +79,19 @@ class ConfigTestFormController extends EntityFormController {
drupal_set_message(format_string('%label configuration has been created.', array('%label' => $entity->label())));
}
- $form_state['redirect'] = 'admin/structure/config_test';
+ $form_state['redirect_route']['route_name'] = 'config_test.list_page';
}
/**
* Overrides Drupal\Core\Entity\EntityFormController::delete().
*/
public function delete(array $form, array &$form_state) {
- $entity = $this->entity;
- $form_state['redirect'] = 'admin/structure/config_test/manage/' . $entity->id() . '/delete';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'config_test.entity_delete',
+ 'route_parameters' => array(
+ 'config_test' => $this->entity->id(),
+ ),
+ );
}
}
diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Form/ConfigTestDeleteForm.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Form/ConfigTestDeleteForm.php
index c41396d..4d0a184 100644
--- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Form/ConfigTestDeleteForm.php
+++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Form/ConfigTestDeleteForm.php
@@ -43,7 +43,7 @@ class ConfigTestDeleteForm extends EntityConfirmFormBase {
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'] = 'admin/structure/config_test';
+ $form_state['redirect_route']['route_name'] = 'config_test.list_page';
}
}
diff --git a/core/modules/contact/lib/Drupal/contact/CategoryFormController.php b/core/modules/contact/lib/Drupal/contact/CategoryFormController.php
index bd12a66..a383881 100644
--- a/core/modules/contact/lib/Drupal/contact/CategoryFormController.php
+++ b/core/modules/contact/lib/Drupal/contact/CategoryFormController.php
@@ -121,14 +121,17 @@ class CategoryFormController extends EntityFormController {
->save();
}
- $form_state['redirect'] = 'admin/structure/contact';
+ $form_state['redirect_route']['route_name'] = 'contact.category_list';
}
/**
* Overrides Drupal\Core\Entity\EntityFormController::delete().
*/
public function delete(array $form, array &$form_state) {
- $form_state['redirect'] = 'admin/structure/contact/manage/' . $this->entity->id() . '/delete';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'contact.category_delete',
+ 'route_parameters' => array('contact_category' => $this->entity->id()),
+ );
}
}
diff --git a/core/modules/contact/lib/Drupal/contact/Form/CategoryDeleteForm.php b/core/modules/contact/lib/Drupal/contact/Form/CategoryDeleteForm.php
index 9b74947..dac498e 100644
--- a/core/modules/contact/lib/Drupal/contact/Form/CategoryDeleteForm.php
+++ b/core/modules/contact/lib/Drupal/contact/Form/CategoryDeleteForm.php
@@ -44,7 +44,7 @@ class CategoryDeleteForm extends EntityConfirmFormBase {
$this->entity->delete();
drupal_set_message(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'] = 'admin/structure/contact';
+ $form_state['redirect_route']['route_name'] = 'contact.category_list';
}
}
diff --git a/core/modules/contact/lib/Drupal/contact/MessageFormController.php b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
index b056dc6..ca4a607 100644
--- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php
+++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
@@ -212,7 +212,7 @@ class MessageFormController extends ContentEntityFormController {
$form_state['redirect'] = array($uri['path'], $uri['options']);
}
else {
- $form_state['redirect'] = '';
+ $form_state['redirect_route']['route_name'] = '<front>';
}
}
}
diff --git a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeDeleteForm.php b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeDeleteForm.php
index aa26aee..beee9d7 100644
--- a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeDeleteForm.php
+++ b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeDeleteForm.php
@@ -56,8 +56,7 @@ class EntityDisplayModeDeleteForm extends EntityConfirmFormBase {
drupal_set_message(t('Deleted the %label @entity-type.', array('%label' => $this->entity->label(), '@entity-type' => strtolower($entity_info['label']))));
$this->entity->delete();
entity_info_cache_clear();
- $short_type = str_replace('_mode', '', $this->entity->entityType());
- $form_state['redirect'] = "admin/structure/display-modes/$short_type";
+ $form_state['redirect_route']['route_name'] = 'entity.' . $this->entity->entityType() . '_list';
}
}
diff --git a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeEditForm.php b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeEditForm.php
index f413fe4..48c2b96 100644
--- a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeEditForm.php
+++ b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeEditForm.php
@@ -16,8 +16,13 @@ class EntityDisplayModeEditForm extends EntityDisplayModeFormBase {
* {@inheritdoc}
*/
public function delete(array $form, array &$form_state) {
- $short_type = str_replace('_mode', '', $this->entity->entityType());
- $form_state['redirect'] = "admin/structure/display-modes/$short_type/manage/" . $this->entity->id() . '/delete';
+ $entity_type = $this->entity->entityType();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'entity.' . $entity_type . '_delete',
+ 'route_parameters' => array(
+ $entity_type => $this->entity->id(),
+ ),
+ );
}
}
diff --git a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeFormBase.php b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeFormBase.php
index 1d8ada9..dc96922 100644
--- a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeFormBase.php
+++ b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeFormBase.php
@@ -122,8 +122,7 @@ abstract class EntityDisplayModeFormBase extends EntityFormController {
drupal_set_message(t('Saved the %label @entity-type.', array('%label' => $this->entity->label(), '@entity-type' => strtolower($this->entityInfo['label']))));
$this->entity->save();
entity_info_cache_clear();
- $short_type = str_replace('_mode', '', $this->entity->entityType());
- $form_state['redirect'] = "admin/structure/display-modes/$short_type";
+ $form_state['redirect_route']['route_name'] = 'entity.' . $this->entity->entityType() . '_list';
}
}
diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module
index dc0d38f..f9d90c6 100644
--- a/core/modules/field_ui/field_ui.module
+++ b/core/modules/field_ui/field_ui.module
@@ -334,8 +334,12 @@ function field_ui_entity_operation_alter(array &$operations, EntityInterface $en
*/
function field_ui_form_node_type_form_submit($form, &$form_state) {
if ($form_state['triggering_element']['#parents'][0] === 'save_continue') {
- $admin_path = \Drupal::entityManager()->getAdminPath('node', $form_state['values']['type']);
- $form_state['redirect'] = "$admin_path/fields";
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'field_ui.overview_node',
+ 'route_parameters' => array(
+ 'bundle' => $form_state['values']['type'],
+ ),
+ );
}
}
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldDeleteForm.php b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldDeleteForm.php
index 16f2004..7e37efb 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldDeleteForm.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldDeleteForm.php
@@ -79,8 +79,12 @@ class FieldDeleteForm extends EntityConfirmFormBase {
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');
}
- $admin_path = $this->entityManager->getAdminPath($this->entity->entity_type, $this->entity->bundle);
- $form_state['redirect'] = "$admin_path/fields";
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'field_ui.overview_' . $this->entity->entity_type,
+ 'route_parameters' => array(
+ 'bundle' => $this->entity->bundle,
+ )
+ );
// 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
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php
index 5ce355c..062dd40 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php
@@ -202,11 +202,17 @@ class FieldEditForm extends FormBase {
try {
$field->save();
drupal_set_message($this->t('Updated field %label field settings.', array('%label' => $this->instance->label())));
- $next_destination = FieldUI::getNextDestination($this->getRequest());
- if (empty($next_destination)) {
- $next_destination = $this->entityManager->getAdminPath($this->instance->entity_type, $this->instance->bundle) . '/fields';
+ if ($next_destination = FieldUI::getNextDestination($this->getRequest())) {
+ $form_state['redirect'] = $next_destination;
+ }
+ else {
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'field_ui.overview_' . $this->instance->entity_type,
+ 'route_parameters' => array(
+ 'bundle' => $this->instance->bundle,
+ )
+ );
}
- $form_state['redirect'] = $next_destination;
}
catch (\Exception $e) {
drupal_set_message($this->t('Attempt to update field %label failed: %message.', array('%label' => $this->instance->label(), '%message' => $e->getMessage())), 'error');
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php
index 642992f..7b50745 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php
@@ -189,7 +189,17 @@ class FieldInstanceEditForm extends FormBase {
drupal_set_message($this->t('Saved %label configuration.', array('%label' => $this->instance->getFieldLabel())));
- $form_state['redirect'] = $this->getNextDestination();
+ if ($next_destination = FieldUI::getNextDestination($this->getRequest())) {
+ $form_state['redirect'] = $next_destination;
+ }
+ else {
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'field_ui.overview_' . $this->instance->entity_type,
+ 'route_parameters' => array(
+ 'bundle' => $this->instance->bundle,
+ )
+ );
+ }
}
/**
@@ -202,21 +212,16 @@ class FieldInstanceEditForm extends FormBase {
$destination = drupal_get_destination();
$request->query->remove('destination');
}
- $form_state['redirect'] = array('admin/structure/types/manage/' . $this->instance->bundle . '/fields/' . $this->instance->id() . '/delete', array('query' => $destination));
- }
-
- /**
- * Returns the next redirect path in a multipage sequence.
- *
- * @return string|array
- * Either the next path, or an array of redirect paths.
- */
- protected function getNextDestination() {
- $next_destination = FieldUI::getNextDestination($this->getRequest());
- if (empty($next_destination)) {
- $next_destination = $this->entityManager->getAdminPath($this->instance->entity_type, $this->instance->bundle) . '/fields';
- }
- return $next_destination;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'field_ui.delete_' . $this->instance->entity_type,
+ 'route_parameters' => array(
+ 'bundle' => $this->instance->bundle,
+ 'field_instance' => $this->instance->id(),
+ ),
+ 'options' => array(
+ 'query' => $destination,
+ ),
+ );
}
}
diff --git a/core/modules/filter/lib/Drupal/filter/FilterFormatFormControllerBase.php b/core/modules/filter/lib/Drupal/filter/FilterFormatFormControllerBase.php
index bd42969..fd79f02 100644
--- a/core/modules/filter/lib/Drupal/filter/FilterFormatFormControllerBase.php
+++ b/core/modules/filter/lib/Drupal/filter/FilterFormatFormControllerBase.php
@@ -263,7 +263,7 @@ abstract class FilterFormatFormControllerBase extends EntityFormController {
}
}
- $form_state['redirect'] = 'admin/config/content/formats';
+ $form_state['redirect_route']['route_name'] = 'filter.admin_overview';
return $this->entity;
}
diff --git a/core/modules/filter/lib/Drupal/filter/Form/FilterDisableForm.php b/core/modules/filter/lib/Drupal/filter/Form/FilterDisableForm.php
index 8cf93d2..125015e 100644
--- a/core/modules/filter/lib/Drupal/filter/Form/FilterDisableForm.php
+++ b/core/modules/filter/lib/Drupal/filter/Form/FilterDisableForm.php
@@ -51,7 +51,7 @@ class FilterDisableForm extends EntityConfirmFormBase {
$this->entity->disable()->save();
drupal_set_message(t('Disabled text format %format.', array('%format' => $this->entity->label())));
- $form_state['redirect'] = 'admin/config/content/formats';
+ $form_state['redirect_route']['route_name'] = 'filter.admin_overview';
}
}
diff --git a/core/modules/forum/lib/Drupal/forum/Form/DeleteForm.php b/core/modules/forum/lib/Drupal/forum/Form/DeleteForm.php
index 5e4d660..66f0545 100644
--- a/core/modules/forum/lib/Drupal/forum/Form/DeleteForm.php
+++ b/core/modules/forum/lib/Drupal/forum/Form/DeleteForm.php
@@ -69,7 +69,7 @@ class DeleteForm extends ConfirmFormBase {
$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'] = 'admin/structure/forum';
+ $form_state['redirect_route']['route_name'] = 'forum.overview';
}
}
diff --git a/core/modules/forum/lib/Drupal/forum/Form/ForumFormController.php b/core/modules/forum/lib/Drupal/forum/Form/ForumFormController.php
index 7b758ef..0605c0a 100644
--- a/core/modules/forum/lib/Drupal/forum/Form/ForumFormController.php
+++ b/core/modules/forum/lib/Drupal/forum/Form/ForumFormController.php
@@ -94,7 +94,7 @@ class ForumFormController extends TermFormController {
break;
}
- $form_state['redirect'] = 'admin/structure/forum';
+ $form_state['redirect_route']['route_name'] = 'forum.overview';
return $term;
}
@@ -108,10 +108,14 @@ class ForumFormController extends TermFormController {
$destination = drupal_get_destination();
$request->query->remove('destination');
}
- $term = $this->getEntity($form_state);
- $form_state['redirect'] = array(
- 'admin/structure/forum/delete/forum/' . $term->id(),
- array('query' => $destination),
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'forum.delete',
+ 'route_parameters' => array(
+ 'taxonomy_term' => $this->entity->id(),
+ ),
+ 'options' => array(
+ 'query' => $destination,
+ ),
);
}
diff --git a/core/modules/image/lib/Drupal/image/Form/ImageEffectDeleteForm.php b/core/modules/image/lib/Drupal/image/Form/ImageEffectDeleteForm.php
index 5f26db3..edc71af 100644
--- a/core/modules/image/lib/Drupal/image/Form/ImageEffectDeleteForm.php
+++ b/core/modules/image/lib/Drupal/image/Form/ImageEffectDeleteForm.php
@@ -78,7 +78,12 @@ class ImageEffectDeleteForm extends ConfirmFormBase {
public function submitForm(array &$form, array &$form_state) {
$this->imageStyle->deleteImageEffect($this->imageEffect);
drupal_set_message($this->t('The image effect %name has been deleted.', array('%name' => $this->imageEffect->label())));
- $form_state['redirect'] = 'admin/config/media/image-styles/manage/' . $this->imageStyle->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'image.style_edit',
+ 'route_parameters' => array(
+ 'image_style' => $this->imageStyle->id(),
+ ),
+ );
}
}
diff --git a/core/modules/image/lib/Drupal/image/Form/ImageEffectFormBase.php b/core/modules/image/lib/Drupal/image/Form/ImageEffectFormBase.php
index c26ab8c..8ddc426 100644
--- a/core/modules/image/lib/Drupal/image/Form/ImageEffectFormBase.php
+++ b/core/modules/image/lib/Drupal/image/Form/ImageEffectFormBase.php
@@ -107,7 +107,12 @@ abstract class ImageEffectFormBase extends FormBase {
$this->imageStyle->saveImageEffect($form_state['values']);
drupal_set_message($this->t('The image effect was successfully applied.'));
- $form_state['redirect'] = 'admin/config/media/image-styles/manage/' . $this->imageStyle->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'image.style_edit',
+ 'route_parameters' => array(
+ 'image_style' => $this->imageStyle->id(),
+ ),
+ );
}
/**
diff --git a/core/modules/image/lib/Drupal/image/Form/ImageStyleDeleteForm.php b/core/modules/image/lib/Drupal/image/Form/ImageStyleDeleteForm.php
index 6cfe354..470f31d 100644
--- a/core/modules/image/lib/Drupal/image/Form/ImageStyleDeleteForm.php
+++ b/core/modules/image/lib/Drupal/image/Form/ImageStyleDeleteForm.php
@@ -66,7 +66,7 @@ class ImageStyleDeleteForm extends EntityConfirmFormBase {
$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'] = 'admin/config/media/image-styles';
+ $form_state['redirect_route']['route_name'] = 'image.style_list';
}
}
diff --git a/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php b/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php
index 50c665e..1206213 100644
--- a/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php
+++ b/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php
@@ -184,8 +184,16 @@ class ImageStyleEditForm extends ImageStyleFormBase {
// Load the configuration form for this option.
if (is_subclass_of($effect['class'], '\Drupal\image\ConfigurableImageEffectInterface')) {
- $path = 'admin/config/media/image-styles/manage/' . $this->entity->id() . '/add/' . $form_state['values']['new'];
- $form_state['redirect'] = array($path, array('query' => array('weight' => $form_state['values']['weight'])));
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'image.effect_add_form',
+ 'route_parameters' => array(
+ 'image_style' => $this->entity->id(),
+ 'image_effect' => $form_state['values']['new'],
+ ),
+ 'options' => array(
+ 'query' => array('weight' => $form_state['values']['weight']),
+ ),
+ );
}
// If there's no form, immediately add the image effect.
else {
diff --git a/core/modules/image/lib/Drupal/image/Form/ImageStyleFlushForm.php b/core/modules/image/lib/Drupal/image/Form/ImageStyleFlushForm.php
index 41aa023..2c87bb2 100644
--- a/core/modules/image/lib/Drupal/image/Form/ImageStyleFlushForm.php
+++ b/core/modules/image/lib/Drupal/image/Form/ImageStyleFlushForm.php
@@ -50,7 +50,7 @@ class ImageStyleFlushForm extends EntityConfirmFormBase {
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'] = 'admin/config/media/image-styles';
+ $form_state['redirect_route']['route_name'] = 'image.style_list';
}
}
diff --git a/core/modules/image/lib/Drupal/image/Form/ImageStyleFormBase.php b/core/modules/image/lib/Drupal/image/Form/ImageStyleFormBase.php
index 0b16e80..3ec0b2d 100644
--- a/core/modules/image/lib/Drupal/image/Form/ImageStyleFormBase.php
+++ b/core/modules/image/lib/Drupal/image/Form/ImageStyleFormBase.php
@@ -69,7 +69,12 @@ abstract class ImageStyleFormBase extends EntityFormController {
* {@inheritdoc}
*/
public function save(array $form, array &$form_state) {
- $form_state['redirect'] = 'admin/config/media/image-styles/manage/' . $this->entity->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'image.style_edit',
+ 'route_parameters' => array(
+ 'image_style' => $this->entity->id(),
+ ),
+ );
return $this->entity->save();
}
diff --git a/core/modules/language/language.admin.inc b/core/modules/language/language.admin.inc
index e740342..f9443c7 100644
--- a/core/modules/language/language.admin.inc
+++ b/core/modules/language/language.admin.inc
@@ -281,7 +281,7 @@ function language_negotiation_configure_form_submit($form, &$form_state) {
\Drupal::service('plugin.manager.block')->clearCachedDefinitions();
}
- $form_state['redirect'] = 'admin/config/regional/language/detection';
+ $form_state['redirect_route']['route_name'] = 'language.negotiation';
drupal_set_message(t('Language negotiation configuration saved.'));
}
diff --git a/core/modules/language/lib/Drupal/language/Form/LanguageAddForm.php b/core/modules/language/lib/Drupal/language/Form/LanguageAddForm.php
index 111bdfc..09420b0 100644
--- a/core/modules/language/lib/Drupal/language/Form/LanguageAddForm.php
+++ b/core/modules/language/lib/Drupal/language/Form/LanguageAddForm.php
@@ -103,7 +103,7 @@ class LanguageAddForm extends LanguageFormBase {
// Tell the user they have the option to add a language switcher block
// to their theme so they can switch between the languages.
drupal_set_message($this->t('Use one of the language switcher blocks to allow site visitors to switch between languages. You can enable these blocks on the <a href="@block-admin">block administration page</a>.', array('@block-admin' => url('admin/structure/block'))));
- $form_state['redirect'] = 'admin/config/regional/language';
+ $form_state['redirect_route']['route_name'] = 'language.admin_overview';
}
/**
diff --git a/core/modules/language/lib/Drupal/language/Form/LanguageDeleteForm.php b/core/modules/language/lib/Drupal/language/Form/LanguageDeleteForm.php
index dcb1f96..241bbe7 100644
--- a/core/modules/language/lib/Drupal/language/Form/LanguageDeleteForm.php
+++ b/core/modules/language/lib/Drupal/language/Form/LanguageDeleteForm.php
@@ -115,7 +115,7 @@ class LanguageDeleteForm extends EntityConfirmFormBase {
drupal_set_message($this->t('The %language (%langcode) language has been removed.', array('%language' => $this->entity->label(), '%langcode' => $this->entity->id())));
}
- $form_state['redirect'] = 'admin/config/regional/language';
+ $form_state['redirect_route']['route_name'] = 'language.admin_overview';
}
}
diff --git a/core/modules/language/lib/Drupal/language/Form/LanguageEditForm.php b/core/modules/language/lib/Drupal/language/Form/LanguageEditForm.php
index 6c61a8b..66e1ed1 100644
--- a/core/modules/language/lib/Drupal/language/Form/LanguageEditForm.php
+++ b/core/modules/language/lib/Drupal/language/Form/LanguageEditForm.php
@@ -54,7 +54,7 @@ class LanguageEditForm extends LanguageFormBase {
$language->name = $form_state['values']['name'];
$language->direction = $form_state['values']['direction'];
language_save($language);
- $form_state['redirect'] = 'admin/config/regional/language';
+ $form_state['redirect_route']['route_name'] = 'language.admin_overview';
}
}
diff --git a/core/modules/language/lib/Drupal/language/Form/NegotiationBrowserDeleteForm.php b/core/modules/language/lib/Drupal/language/Form/NegotiationBrowserDeleteForm.php
index 51f161b..1d4260b 100644
--- a/core/modules/language/lib/Drupal/language/Form/NegotiationBrowserDeleteForm.php
+++ b/core/modules/language/lib/Drupal/language/Form/NegotiationBrowserDeleteForm.php
@@ -66,7 +66,7 @@ class NegotiationBrowserDeleteForm extends ConfirmFormBase {
language_set_browser_drupal_langcode_mappings($mappings);
}
- $form_state['redirect'] = 'admin/config/regional/language/detection/browser';
+ $form_state['redirect_route']['route_name'] = 'language.negotiation_browser';
}
}
diff --git a/core/modules/language/lib/Drupal/language/Form/NegotiationBrowserForm.php b/core/modules/language/lib/Drupal/language/Form/NegotiationBrowserForm.php
index 5cc3c4b..d5b991d 100644
--- a/core/modules/language/lib/Drupal/language/Form/NegotiationBrowserForm.php
+++ b/core/modules/language/lib/Drupal/language/Form/NegotiationBrowserForm.php
@@ -178,7 +178,7 @@ class NegotiationBrowserForm extends ConfigFormBase {
$config->setData($mappings);
$config->save();
}
- $form_state['redirect'] = 'admin/config/regional/language/detection';
+ $form_state['redirect_route']['route_name'] = 'language.negotiation';
parent::submitForm($form, $form_state);
}
diff --git a/core/modules/language/lib/Drupal/language/Form/NegotiationSessionForm.php b/core/modules/language/lib/Drupal/language/Form/NegotiationSessionForm.php
index 835196a..b688b05 100644
--- a/core/modules/language/lib/Drupal/language/Form/NegotiationSessionForm.php
+++ b/core/modules/language/lib/Drupal/language/Form/NegotiationSessionForm.php
@@ -33,7 +33,7 @@ class NegotiationSessionForm extends ConfigFormBase {
'#description' => t('Name of the request/session parameter used to determine the desired language.'),
);
- $form_state['redirect'] = 'admin/config/regional/language/detection';
+ $form_state['redirect_route']['route_name'] = 'language.negotiation';
return parent::buildForm($form, $form_state);
}
diff --git a/core/modules/language/lib/Drupal/language/Form/NegotiationUrlForm.php b/core/modules/language/lib/Drupal/language/Form/NegotiationUrlForm.php
index 04e1e52..4a7adb0 100644
--- a/core/modules/language/lib/Drupal/language/Form/NegotiationUrlForm.php
+++ b/core/modules/language/lib/Drupal/language/Form/NegotiationUrlForm.php
@@ -86,7 +86,7 @@ class NegotiationUrlForm extends ConfigFormBase {
);
}
- $form_state['redirect'] = 'admin/config/regional/language/detection';
+ $form_state['redirect_route']['route_name'] = 'language.negotiation';
return parent::buildForm($form, $form_state);
}
diff --git a/core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php b/core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php
index 4524b2d..a80fa91 100644
--- a/core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php
+++ b/core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php
@@ -231,7 +231,12 @@ class TranslateEditForm extends TranslateFormBase {
// Keep the user on the current pager page.
$page = $this->getRequest()->query->get('page');
if (isset($page)) {
- $form_state['redirect'] = array('admin/config/regional/translate', array('query' => array('page' => $page)));
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'locale.translate_page',
+ 'options' => array(
+ 'page' => $page,
+ ),
+ );
}
if ($updated) {
diff --git a/core/modules/locale/lib/Drupal/locale/Form/TranslateFilterForm.php b/core/modules/locale/lib/Drupal/locale/Form/TranslateFilterForm.php
index 9bc9987..9018755 100644
--- a/core/modules/locale/lib/Drupal/locale/Form/TranslateFilterForm.php
+++ b/core/modules/locale/lib/Drupal/locale/Form/TranslateFilterForm.php
@@ -91,7 +91,7 @@ class TranslateFilterForm extends TranslateFormBase {
$_SESSION['locale_translate_filter'][$name] = $form_state['values'][$name];
}
}
- $form_state['redirect'] = 'admin/config/regional/translate';
+ $form_state['redirect_route']['route_name'] = 'locale.translate_page';
}
/**
@@ -99,7 +99,7 @@ class TranslateFilterForm extends TranslateFormBase {
*/
public function resetForm(array &$form, array &$form_state) {
$_SESSION['locale_translate_filter'] = array();
- $form_state['redirect'] = 'admin/config/regional/translate';
+ $form_state['redirect_route']['route_name'] = 'locale.translate_page';
}
}
diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc
index 1a53771..a0eb62c 100644
--- a/core/modules/locale/locale.bulk.inc
+++ b/core/modules/locale/locale.bulk.inc
@@ -137,7 +137,7 @@ function locale_translate_import_form_submit($form, &$form_state) {
return;
}
- $form_state['redirect'] = 'admin/config/regional/translate';
+ $form_state['redirect_route']['route_name'] = 'locale.translate_page';
return;
}
diff --git a/core/modules/menu/lib/Drupal/menu/Form/MenuDeleteForm.php b/core/modules/menu/lib/Drupal/menu/Form/MenuDeleteForm.php
index ac1e7fb..35d074d 100644
--- a/core/modules/menu/lib/Drupal/menu/Form/MenuDeleteForm.php
+++ b/core/modules/menu/lib/Drupal/menu/Form/MenuDeleteForm.php
@@ -97,7 +97,7 @@ class MenuDeleteForm extends EntityConfirmFormBase {
* {@inheritdoc}
*/
public function submit(array $form, array &$form_state) {
- $form_state['redirect'] = 'admin/structure/menu';
+ $form_state['redirect_route']['route_name'] = 'menu.overview_page';
// Locked menus may not be deleted.
if ($this->entity->isLocked()) {
diff --git a/core/modules/menu/lib/Drupal/menu/Form/MenuLinkDeleteForm.php b/core/modules/menu/lib/Drupal/menu/Form/MenuLinkDeleteForm.php
index 2815a91..efc9cdd 100644
--- a/core/modules/menu/lib/Drupal/menu/Form/MenuLinkDeleteForm.php
+++ b/core/modules/menu/lib/Drupal/menu/Form/MenuLinkDeleteForm.php
@@ -41,7 +41,12 @@ class MenuLinkDeleteForm extends EntityConfirmFormBase {
$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'] = 'admin/structure/menu/manage/' . $this->entity->menu_name;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'menu.menu_edit',
+ 'route_parameters' => array(
+ 'menu' => $this->entity->menu_name,
+ ),
+ );
}
}
diff --git a/core/modules/menu/lib/Drupal/menu/Form/MenuLinkResetForm.php b/core/modules/menu/lib/Drupal/menu/Form/MenuLinkResetForm.php
index 5b79ef4..7542c57 100644
--- a/core/modules/menu/lib/Drupal/menu/Form/MenuLinkResetForm.php
+++ b/core/modules/menu/lib/Drupal/menu/Form/MenuLinkResetForm.php
@@ -53,7 +53,12 @@ class MenuLinkResetForm extends EntityConfirmFormBase {
public function submit(array $form, array &$form_state) {
$new_menu_link = $this->entity->reset();
drupal_set_message(t('The menu link was reset to its default settings.'));
- $form_state['redirect'] = 'admin/structure/menu/manage/' . $new_menu_link->menu_name;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'menu.menu_edit',
+ 'route_parameters' => array(
+ 'menu' => $new_menu_link->menu_name,
+ ),
+ );
}
}
diff --git a/core/modules/menu/lib/Drupal/menu/MenuFormController.php b/core/modules/menu/lib/Drupal/menu/MenuFormController.php
index 8d9ca26..5e369d5 100644
--- a/core/modules/menu/lib/Drupal/menu/MenuFormController.php
+++ b/core/modules/menu/lib/Drupal/menu/MenuFormController.php
@@ -215,14 +215,24 @@ class MenuFormController extends EntityFormController {
watchdog('menu', 'Menu %label has been added.', array('%label' => $menu->label()), WATCHDOG_NOTICE, l(t('Edit'), $uri['path'] . '/edit'));
}
- $form_state['redirect'] = 'admin/structure/menu/manage/' . $menu->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'menu.menu_edit',
+ 'route_parameters' => array(
+ 'menu' => $this->entity->id(),
+ ),
+ );
}
/**
* {@inheritdoc}
*/
public function delete(array $form, array &$form_state) {
- $form_state['redirect'] = 'admin/structure/menu/manage/' . $this->entity->id() . '/delete';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'menu.delete_menu',
+ 'route_parameters' => array(
+ 'menu' => $this->entity->id(),
+ ),
+ );
}
/**
diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php
index 3222a68..ef70aff 100644
--- a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php
+++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php
@@ -297,7 +297,12 @@ class MenuLinkFormController extends EntityFormController {
if ($saved) {
drupal_set_message(t('The menu link has been saved.'));
- $form_state['redirect'] = 'admin/structure/menu/manage/' . $menu_link->menu_name;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'menu.menu_edit',
+ 'route_parameters' => array(
+ 'menu' => $menu_link->menu_name,
+ ),
+ );
}
else {
drupal_set_message(t('There was an error saving the menu link.'), 'error');
@@ -310,6 +315,11 @@ class MenuLinkFormController extends EntityFormController {
*/
public function delete(array $form, array &$form_state) {
$menu_link = $this->entity;
- $form_state['redirect'] = 'admin/structure/menu/item/' . $menu_link->id() . '/delete';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'menu.link_delete',
+ 'route_parameters' => array(
+ 'menu' => $menu_link->id(),
+ ),
+ );
}
}
diff --git a/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php b/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php
index 52e4dfb..c847004 100644
--- a/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php
+++ b/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php
@@ -126,7 +126,7 @@ class DeleteMultiple extends ConfirmFormBase implements ContainerInjectionInterf
drupal_set_message(format_plural($count, 'Deleted 1 post.', 'Deleted @count posts.'));
Cache::invalidateTags(array('content' => TRUE));
}
- $form_state['redirect'] = 'admin/content';
+ $form_state['redirect_route']['route_name'] = 'node.content_overview';
}
}
diff --git a/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php b/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php
index 51da037..644b069 100644
--- a/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php
+++ b/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php
@@ -91,7 +91,7 @@ class NodeDeleteForm extends ContentEntityConfirmFormBase {
$node_type = $node_type_storage->load($this->entity->bundle())->label();
drupal_set_message(t('@type %title has been deleted.', array('@type' => $node_type, '%title' => $this->entity->label())));
Cache::invalidateTags(array('content' => TRUE));
- $form_state['redirect'] = '<front>';
+ $form_state['redirect_route']['route_name'] = '<front>';
}
}
diff --git a/core/modules/node/lib/Drupal/node/Form/NodeRevisionDeleteForm.php b/core/modules/node/lib/Drupal/node/Form/NodeRevisionDeleteForm.php
index 1ce40f7..99edd0e 100644
--- a/core/modules/node/lib/Drupal/node/Form/NodeRevisionDeleteForm.php
+++ b/core/modules/node/lib/Drupal/node/Form/NodeRevisionDeleteForm.php
@@ -123,9 +123,14 @@ class NodeRevisionDeleteForm extends ConfirmFormBase implements ContainerInjecti
watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $this->revision->bundle(), '%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()));
$node_type = $this->nodeTypeStorage->load($this->revision->bundle())->label();
drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($this->revision->getRevisionCreationTime()), '@type' => $node_type, '%title' => $this->revision->label())));
- $form_state['redirect'] = 'node/' . $this->revision->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'node.view',
+ 'route_parameters' => array(
+ 'node' => $this->revision->id(),
+ ),
+ );
if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {node_field_revision} WHERE nid = :nid', array(':nid' => $this->revision->id()))->fetchField() > 1) {
- $form_state['redirect'] .= '/revisions';
+ $form_state['redirect_route']['route_name'] = 'node.revision_overview';
}
}
diff --git a/core/modules/node/lib/Drupal/node/Form/NodeRevisionRevertForm.php b/core/modules/node/lib/Drupal/node/Form/NodeRevisionRevertForm.php
index 72f6dc5..12cb9e3 100644
--- a/core/modules/node/lib/Drupal/node/Form/NodeRevisionRevertForm.php
+++ b/core/modules/node/lib/Drupal/node/Form/NodeRevisionRevertForm.php
@@ -115,7 +115,12 @@ class NodeRevisionRevertForm extends ConfirmFormBase implements ContainerInjecti
watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $this->revision->bundle(), '%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()));
drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_get_type_label($this->revision), '%title' => $this->revision->label(), '%revision-date' => format_date($original_revision_timestamp))));
- $form_state['redirect'] = 'node/' . $this->revision->id() . '/revisions';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'node.revision_overview',
+ 'route_parameters' => array(
+ 'node' => $this->revision->id(),
+ ),
+ );
}
}
diff --git a/core/modules/node/lib/Drupal/node/Form/NodeTypeDeleteConfirm.php b/core/modules/node/lib/Drupal/node/Form/NodeTypeDeleteConfirm.php
index 06c5766..8adc575 100644
--- a/core/modules/node/lib/Drupal/node/Form/NodeTypeDeleteConfirm.php
+++ b/core/modules/node/lib/Drupal/node/Form/NodeTypeDeleteConfirm.php
@@ -89,7 +89,7 @@ class NodeTypeDeleteConfirm extends EntityConfirmFormBase {
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'] = 'admin/structure/types';
+ $form_state['redirect_route']['route_name'] = 'node.overview_types';
}
}
diff --git a/core/modules/node/lib/Drupal/node/Form/RebuildPermissionsForm.php b/core/modules/node/lib/Drupal/node/Form/RebuildPermissionsForm.php
index cd12cb5..ee70dfd 100644
--- a/core/modules/node/lib/Drupal/node/Form/RebuildPermissionsForm.php
+++ b/core/modules/node/lib/Drupal/node/Form/RebuildPermissionsForm.php
@@ -53,7 +53,7 @@ class RebuildPermissionsForm extends ConfirmFormBase {
*/
public function submitForm(array &$form, array &$form_state) {
node_access_rebuild(TRUE);
- $form_state['redirect'] = 'admin/reports/status';
+ $form_state['redirect_route']['route_name'] = 'system.status';
}
}
diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php
index e14a662..659777a 100644
--- a/core/modules/node/lib/Drupal/node/NodeFormController.php
+++ b/core/modules/node/lib/Drupal/node/NodeFormController.php
@@ -482,7 +482,17 @@ class NodeFormController extends ContentEntityFormController {
if ($node->id()) {
$form_state['values']['nid'] = $node->id();
$form_state['nid'] = $node->id();
- $form_state['redirect'] = node_access('view', $node) ? 'node/' . $node->id() : '<front>';
+ if ($node->access('view')) {
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'node.view',
+ 'route_parameters' => array(
+ 'node' => $node->id(),
+ ),
+ );
+ }
+ else {
+ $form_state['redirect_route']['route_name'] = '<front>';
+ }
}
else {
// In the unlikely case something went wrong on save, the node will be
@@ -505,8 +515,15 @@ class NodeFormController extends ContentEntityFormController {
$destination = drupal_get_destination();
$query->remove('destination');
}
- $node = $this->entity;
- $form_state['redirect'] = array('node/' . $node->id() . '/delete', array('query' => $destination));
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'node.delete_confirm',
+ 'route_parameters' => array(
+ 'node' => $this->entity->id(),
+ ),
+ 'options' => array(
+ 'query' => $destination,
+ ),
+ );
}
}
diff --git a/core/modules/node/lib/Drupal/node/NodeTypeFormController.php b/core/modules/node/lib/Drupal/node/NodeTypeFormController.php
index a385b20..ef94963 100644
--- a/core/modules/node/lib/Drupal/node/NodeTypeFormController.php
+++ b/core/modules/node/lib/Drupal/node/NodeTypeFormController.php
@@ -236,14 +236,19 @@ class NodeTypeFormController extends EntityFormController {
watchdog('node', 'Added content type %name.', $t_args, WATCHDOG_NOTICE, l(t('view'), 'admin/structure/types'));
}
- $form_state['redirect'] = 'admin/structure/types';
+ $form_state['redirect_route']['route_name'] = 'node.overview_types';
}
/**
* {@inheritdoc}
*/
public function delete(array $form, array &$form_state) {
- $form_state['redirect'] = 'admin/structure/types/manage/' . $this->entity->id() . '/delete';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'node.type_delete_confirm',
+ 'route_parameters' => array(
+ 'node_type' => $this->entity->id(),
+ ),
+ );
}
}
diff --git a/core/modules/picture/lib/Drupal/picture/Form/PictureMappingDeleteForm.php b/core/modules/picture/lib/Drupal/picture/Form/PictureMappingDeleteForm.php
index 26983be..ba47dd0 100644
--- a/core/modules/picture/lib/Drupal/picture/Form/PictureMappingDeleteForm.php
+++ b/core/modules/picture/lib/Drupal/picture/Form/PictureMappingDeleteForm.php
@@ -41,7 +41,7 @@ class PictureMappingDeleteForm extends EntityConfirmFormBase {
$this->entity->delete();
drupal_set_message(t('Picture mapping %label has been deleted.', array('%label' => $this->entity->label())));
watchdog('picture', 'Picture mapping %label has been deleted.', array('%label' => $this->entity->label()), WATCHDOG_NOTICE);
- $form_state['redirect'] = 'admin/config/media/picturemapping';
+ $form_state['redirect_route']['route_name'] = 'picture.mapping_page';
}
}
diff --git a/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php b/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php
index b7831c2..00f5b9f 100644
--- a/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php
+++ b/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php
@@ -143,11 +143,15 @@ class PictureMappingFormController extends EntityFormController {
// Redirect to edit form after creating a new mapping or after selecting
// another breakpoint group.
if (!$picture_mapping->hasMappings()) {
- $uri = $picture_mapping->uri();
- $form_state['redirect'] = $uri['path'];
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'picture.mapping_page_edit',
+ 'route_parameters' => array(
+ 'picture_mapping' => $picture_mapping->id(),
+ ),
+ );
}
else {
- $form_state['redirect'] = 'admin/config/media/picturemapping';
+ $form_state['redirect_route']['route_name'] = 'picture.mapping_page';
}
}
diff --git a/core/modules/search/lib/Drupal/search/Form/ReindexConfirm.php b/core/modules/search/lib/Drupal/search/Form/ReindexConfirm.php
index c865489..f4ed6de 100644
--- a/core/modules/search/lib/Drupal/search/Form/ReindexConfirm.php
+++ b/core/modules/search/lib/Drupal/search/Form/ReindexConfirm.php
@@ -65,8 +65,7 @@ class ReindexConfirm extends ConfirmFormBase {
if ($form['confirm']) {
search_reindex();
drupal_set_message($this->t('The index will be rebuilt.'));
- $form_state['redirect'] = 'admin/config/search/settings';
- return;
+ $form_state['redirect_route']['route_name'] = 'search.settings';
}
}
}
diff --git a/core/modules/search/lib/Drupal/search/Form/SearchBlockForm.php b/core/modules/search/lib/Drupal/search/Form/SearchBlockForm.php
index 1ef1841..c2f14e7 100644
--- a/core/modules/search/lib/Drupal/search/Form/SearchBlockForm.php
+++ b/core/modules/search/lib/Drupal/search/Form/SearchBlockForm.php
@@ -64,7 +64,12 @@ class SearchBlockForm extends FormBase {
$form_id = $form['form_id']['#value'];
$info = search_get_default_plugin_info();
if ($info) {
- $form_state['redirect'] = 'search/' . $info['path'] . '/' . trim($form_state['values'][$form_id]);
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'search.view_' . $info['id'],
+ 'route_parameters' => array(
+ 'keys' => trim($form_state['values'][$form_id]),
+ ),
+ );
}
else {
form_set_error(NULL, $this->t('Search is currently disabled.'), 'error');
diff --git a/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php b/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php
index 68876e2..0bf795a 100644
--- a/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php
+++ b/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php
@@ -273,7 +273,7 @@ class SearchSettingsForm extends ConfigFormBase {
*/
public function searchAdminReindexSubmit(array $form, array &$form_state) {
// send the user to the confirmation page
- $form_state['redirect'] = 'admin/config/search/settings/reindex';
+ $form_state['redirect_route']['route_name'] = 'search.reindex_confirm';
}
}
diff --git a/core/modules/search/search.module b/core/modules/search/search.module
index 3fc2953..56e6859 100644
--- a/core/modules/search/search.module
+++ b/core/modules/search/search.module
@@ -640,63 +640,6 @@ function search_mark_for_reindex($type, $sid) {
*/
/**
- * Form constructor for the search block's search box.
- *
- * @param $form_id
- * The unique string identifying the desired form.
- *
- * @see search_box_form_submit()
- *
- * @ingroup forms
- */
-function search_box($form, &$form_state, $form_id) {
- $form[$form_id] = array(
- '#type' => 'search',
- '#title' => t('Search'),
- '#title_display' => 'invisible',
- '#size' => 15,
- '#default_value' => '',
- '#attributes' => array('title' => t('Enter the terms you wish to search for.')),
- );
- $form['actions'] = array('#type' => 'actions');
- $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Search'));
- $form['#submit'][] = 'search_box_form_submit';
-
- return $form;
-}
-
-/**
- * Form submission handler for search_box().
- */
-function search_box_form_submit($form, &$form_state) {
- // The search form relies on control of the redirect destination for its
- // functionality, so we override any static destination set in the request.
- // See http://drupal.org/node/292565.
- if (isset($_GET['destination'])) {
- unset($_GET['destination']);
- }
-
- // Check to see if the form was submitted empty.
- // If it is empty, display an error message.
- // (This method is used instead of setting #required to TRUE for this field
- // because that results in a confusing error message. It would say a plain
- // "field is required" because the search keywords field has no title.
- // The error message would also complain about a missing #title field.)
- if ($form_state['values']['search_block_form'] == '') {
- form_set_error('keys', t('Please enter some keywords.'));
- }
-
- $form_id = $form['form_id']['#value'];
- $info = search_get_default_plugin_info();
- if ($info) {
- $form_state['redirect'] = 'search/' . $info['path'] . '/' . trim($form_state['values'][$form_id]);
- }
- else {
- form_set_error(NULL, t('Search is currently disabled.'), 'error');
- }
-}
-
-/**
* Returns snippets from a piece of text, with certain keywords highlighted.
*
* Used for formatting search results.
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Form/LinkDelete.php b/core/modules/shortcut/lib/Drupal/shortcut/Form/LinkDelete.php
index 555308d..5f50096 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/Form/LinkDelete.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/Form/LinkDelete.php
@@ -70,7 +70,12 @@ class LinkDelete extends ConfirmFormBase {
public function submitForm(array &$form, array &$form_state) {
menu_link_delete($this->menuLink->mlid);
$set_name = str_replace('shortcut-', '' , $this->menuLink->menu_name);
- $form_state['redirect'] = 'admin/config/user-interface/shortcut/manage/' . $set_name;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'shortcut.set_customize',
+ 'route_parameters' => array(
+ 'shortcut_set' => $set_name,
+ ),
+ );
drupal_set_message(t('The shortcut %title has been deleted.', array('%title' => $this->menuLink->link_title)));
}
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Form/ShortcutSetDeleteForm.php b/core/modules/shortcut/lib/Drupal/shortcut/Form/ShortcutSetDeleteForm.php
index d7cdd9a..0b97ded 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/Form/ShortcutSetDeleteForm.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/Form/ShortcutSetDeleteForm.php
@@ -107,7 +107,7 @@ class ShortcutSetDeleteForm extends EntityConfirmFormBase {
*/
public function submit(array $form, array &$form_state) {
$this->entity->delete();
- $form_state['redirect'] = 'admin/config/user-interface/shortcut';
+ $form_state['redirect_route']['route_name'] = 'shortcut.set_admin';
drupal_set_message(t('The shortcut set %title has been deleted.', array('%title' => $this->entity->label())));
}
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetFormController.php b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetFormController.php
index 21b3223..8f89a05 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetFormController.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetFormController.php
@@ -83,15 +83,24 @@ class ShortcutSetFormController extends EntityFormController {
else {
drupal_set_message(t('Updated set name to %set-name.', array('%set-name' => $entity->label())));
}
- $form_state['redirect'] = 'admin/config/user-interface/shortcut/manage/' . $entity->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'shortcut.set_customize',
+ 'route_parameters' => array(
+ 'shortcut_set' => $this->entity->id(),
+ ),
+ );
}
/**
* Overrides \Drupal\Core\Entity\EntityFormController::delete().
*/
public function delete(array $form, array &$form_state) {
- $entity = $this->entity;
- $form_state['redirect'] = 'admin/config/user-interface/shortcut/manage/' . $entity->id() . '/delete';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'shortcut.set_delete',
+ 'route_parameters' => array(
+ 'shortcut_set' => $this->entity->id(),
+ ),
+ );
}
}
diff --git a/core/modules/shortcut/shortcut.admin.inc b/core/modules/shortcut/shortcut.admin.inc
index 41214bc..ab998a7 100644
--- a/core/modules/shortcut/shortcut.admin.inc
+++ b/core/modules/shortcut/shortcut.admin.inc
@@ -158,7 +158,12 @@ function shortcut_set_switch_submit($form, &$form_state) {
else {
drupal_set_message(t('%user is now using a new shortcut set called %set_name. You can edit it from this page.', $replacements));
}
- $form_state['redirect'] = 'admin/config/user-interface/shortcut/manage/' . $set->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'shortcut.set_customize',
+ 'route_parameters' => array(
+ 'shortcut_set' => $set->id(),
+ ),
+ );
}
else {
// Switch to a different shortcut set.
@@ -310,7 +315,12 @@ function shortcut_link_edit_submit($form, &$form_state) {
menu_link_save($shortcut_link);
$set_name = str_replace('shortcut-', '' , $shortcut_link['menu_name']);
- $form_state['redirect'] = 'admin/config/user-interface/shortcut/manage/' . $set_name;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'shortcut.set_customize',
+ 'route_parameters' => array(
+ 'shortcut_set' => $set_name,
+ ),
+ );
drupal_set_message(t('The shortcut %link has been updated.', array('%link' => $shortcut_link['link_title'])));
}
@@ -324,7 +334,12 @@ function shortcut_link_add_submit($form, &$form_state) {
$shortcut_link['menu_name'] = $shortcut_set->id();
shortcut_admin_add_link($shortcut_link, $shortcut_set);
$shortcut_set->save();
- $form_state['redirect'] = 'admin/config/user-interface/shortcut/manage/' . $shortcut_set->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'shortcut.set_customize',
+ 'route_parameters' => array(
+ 'shortcut_set' => $shortcut_set->id(),
+ ),
+ );
drupal_set_message(t('Added a shortcut for %title.', array('%title' => $shortcut_link['link_title'])));
}
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php
index b6ec376..8a907f0 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php
@@ -251,7 +251,7 @@ class SimpletestResultsForm extends FormBase {
}
if (!$classes) {
- $form_state['redirect'] = 'admin/config/development/testing';
+ $form_state['redirect_route']['route_name'] = 'simpletest.test_form';
return;
}
@@ -264,7 +264,7 @@ class SimpletestResultsForm extends FormBase {
// Submit the simpletest test form to rerun the tests.
$simpletest_test_form = new SimpletestTestForm();
$simpletest_test_form->submitForm($form_execute, $form_state_execute);
- $form_state['redirect'] = $form_state_execute['redirect'];
+ $form_state['redirect_route'] = $form_state_execute['redirect_route'];
}
/**
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php
index 5ba6734..c469b52 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php
@@ -113,7 +113,12 @@ class SimpletestTestForm extends FormBase {
}
if (count($tests_list) > 0 ) {
$test_id = simpletest_run_tests($tests_list, 'drupal');
- $form_state['redirect'] = 'admin/config/development/testing/results/' . $test_id;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'simpletest.result_form',
+ 'route_parameters' => array(
+ 'test_id' => $test_id,
+ ),
+ );
}
else {
drupal_set_message($this->t('No test(s) selected.'), 'error');
diff --git a/core/modules/system/lib/Drupal/system/Form/DateFormatDeleteForm.php b/core/modules/system/lib/Drupal/system/Form/DateFormatDeleteForm.php
index 619a920..79629fa5 100644
--- a/core/modules/system/lib/Drupal/system/Form/DateFormatDeleteForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/DateFormatDeleteForm.php
@@ -75,7 +75,7 @@ class DateFormatDeleteForm extends EntityConfirmFormBase {
$this->entity->delete();
drupal_set_message(t('Removed date format %format.', array('%format' => $this->entity->label())));
- $form_state['redirect'] = 'admin/config/regional/date-time';
+ $form_state['redirect_route']['route_name'] = 'system.date_format_list';
}
}
diff --git a/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php b/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php
index cc283af..3b6f347 100644
--- a/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php
+++ b/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php
@@ -201,7 +201,7 @@ abstract class DateFormatFormBase extends EntityFormController {
* {@inheritdoc}
*/
public function submit(array $form, array &$form_state) {
- $form_state['redirect'] = 'admin/config/regional/date-time';
+ $form_state['redirect_route']['route_name'] = 'system.date_format_list';
$form_state['values']['pattern'][$this->patternType] = trim($form_state['values']['date_format_pattern']);
parent::submit($form, $form_state);
diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesListConfirmForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListConfirmForm.php
index ccab5b1..3f5ae9f 100644
--- a/core/modules/system/lib/Drupal/system/Form/ModulesListConfirmForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/ModulesListConfirmForm.php
@@ -153,7 +153,7 @@ class ModulesListConfirmForm extends ConfirmFormBase implements ContainerInjecti
drupal_set_message($this->t('The configuration options have been saved.'));
}
- $form_state['redirect'] = 'admin/modules';
+ $form_state['redirect_route']['route_name'] = 'system.modules_list';
}
}
diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
index 5566b28..a090c67 100644
--- a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
@@ -392,7 +392,7 @@ class ModulesListForm extends FormBase {
$this->keyValueExpirable->setWithExpire($account, $modules, 60);
// Redirect to the confirmation form.
- $form_state['redirect'] = 'admin/modules/list/confirm';
+ $form_state['redirect_route']['route_name'] = 'system.modules_list_confirm';
// We can exit here because at least one modules has dependencies
// which we have to prompt the user for in a confirmation form.
diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php
index efc31c1..1a85d9e 100644
--- a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php
@@ -137,7 +137,7 @@ class ModulesUninstallConfirmForm extends ConfirmFormBase implements ContainerIn
$this->moduleHandler->uninstall($this->modules);
drupal_set_message($this->t('The selected modules have been uninstalled.'));
- $form_state['redirect'] = 'admin/modules/uninstall';
+ $form_state['redirect_route']['route_name'] = 'system.modules_uninstall';
}
}
diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php
index ed92064..711f934 100644
--- a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php
@@ -129,7 +129,7 @@ class ModulesUninstallForm extends FormBase {
// Form submitted, but no modules selected.
if (!array_filter($form_state['values']['uninstall'])) {
drupal_set_message($this->t('No modules selected.'), 'error');
- $form_state['redirect'] = 'admin/modules/uninstall';
+ $form_state['redirect_route']['route_name'] = 'system.modules_uninstall';
}
}
@@ -144,6 +144,6 @@ class ModulesUninstallForm extends FormBase {
$this->keyValueExpirable->setWithExpire($account, $uninstall, 60);
// Redirect to the confirm form.
- $form_state['redirect'] = 'admin/modules/uninstall/confirm';
+ $form_state['redirect_route']['route_name'] = 'system.modules_uninstall_confirm';
}
}
diff --git a/core/modules/system/tests/modules/ajax_test/ajax_test.module b/core/modules/system/tests/modules/ajax_test/ajax_test.module
index 802b34e..f42844f 100644
--- a/core/modules/system/tests/modules/ajax_test/ajax_test.module
+++ b/core/modules/system/tests/modules/ajax_test/ajax_test.module
@@ -213,7 +213,7 @@ function ajax_test_dialog_form($form, &$form_state) {
* Non-AJAX behavior of the dialog buttons.
*/
function ajax_test_dialog_form_submit($form, &$form_state) {
- $form_state['redirect'] = 'ajax-test/dialog-contents';
+ $form_state['redirect_route']['route_name'] = 'ajax_test.dialog_contents';
}
/**
diff --git a/core/modules/system/tests/modules/batch_test/batch_test.module b/core/modules/system/tests/modules/batch_test/batch_test.module
index ff0e37f..0dbbff8 100644
--- a/core/modules/system/tests/modules/batch_test/batch_test.module
+++ b/core/modules/system/tests/modules/batch_test/batch_test.module
@@ -108,7 +108,7 @@ function batch_test_simple_form_submit($form, &$form_state) {
$function = '_batch_test_' . $form_state['values']['batch'];
batch_set($function());
- $form_state['redirect'] = 'batch-test/redirect';
+ $form_state['redirect_route']['route_name'] = 'batch_test.redirect';
}
@@ -158,7 +158,7 @@ function batch_test_multistep_form_submit($form, &$form_state) {
}
// This will only be effective on the last step.
- $form_state['redirect'] = 'batch-test/redirect';
+ $form_state['redirect_route']['route_name'] = 'batch_test.redirect';
}
/**
@@ -208,7 +208,7 @@ function batch_test_chained_form_submit_1($form, &$form_state) {
batch_set(_batch_test_batch_1());
// This redirect should not be taken into account.
- $form_state['redirect'] = 'should/be/discarded';
+ $form_state['redirect_route']['route_name'] = 'batch_test.redirect';
}
/**
@@ -224,7 +224,7 @@ function batch_test_chained_form_submit_2($form, &$form_state) {
batch_set(_batch_test_batch_2());
// This redirect should not be taken into account.
- $form_state['redirect'] = 'should/be/discarded';
+ $form_state['redirect_route']['route_name'] = 'batch_test.redirect';
}
/**
@@ -239,7 +239,7 @@ function batch_test_chained_form_submit_3($form, &$form_state) {
$form_state['values']['value']++;
// This redirect should not be taken into account.
- $form_state['redirect'] = 'should/be/discarded';
+ $form_state['redirect_route']['route_name'] = 'batch_test.redirect';
}
/**
@@ -255,7 +255,7 @@ function batch_test_chained_form_submit_4($form, &$form_state) {
batch_set(_batch_test_batch_3());
// This is the redirect that should prevail.
- $form_state['redirect'] = 'batch-test/redirect';
+ $form_state['redirect_route']['route_name'] = 'batch_test.redirect';
}
/**
diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php
index 7b0741d..7fe2812 100644
--- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php
@@ -93,7 +93,13 @@ class EntityTestFormController extends ContentEntityFormController {
drupal_set_message($message);
if ($entity->id()) {
- $form_state['redirect'] = $entity->entityType() . '/manage/' . $entity->id();
+ $entity_type = $entity->entityType();
+ $form_state['redirect_route'] = array(
+ 'route_name' => "entity_test.edit_$entity_type",
+ 'route_parameters' => array(
+ $entity_type => $entity->id(),
+ ),
+ );
}
else {
// Error on save.
@@ -109,6 +115,6 @@ class EntityTestFormController extends ContentEntityFormController {
$entity = $this->entity;
$entity->delete();
drupal_set_message(t('%entity_type @id has been deleted.', array('@id' => $entity->id(), '%entity_type' => $entity->entityType())));
- $form_state['redirect'] = '<front>';
+ $form_state['redirect_route']['route_name'] = '<front>';
}
}
diff --git a/core/modules/system/tests/modules/form_test/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module
index a3d1cd0..6c77151 100644
--- a/core/modules/system/tests/modules/form_test/form_test.module
+++ b/core/modules/system/tests/modules/form_test/form_test.module
@@ -647,7 +647,7 @@ function form_test_storage_form_submit($form, &$form_state) {
if (isset($form_state['storage']['thing']['changed'])) {
drupal_set_message("The thing has been changed.");
}
- $form_state['redirect'] = 'node';
+ $form_state['redirect_route']['route_name'] = '<front>';
}
/**
diff --git a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/ConfirmFormTestForm.php b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/ConfirmFormTestForm.php
index fe5461b..43f8173 100644
--- a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/ConfirmFormTestForm.php
+++ b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/ConfirmFormTestForm.php
@@ -72,7 +72,7 @@ class ConfirmFormTestForm extends ConfirmFormBase {
*/
public function submitForm(array &$form, array &$form_state) {
drupal_set_message($this->t('The ConfirmFormTestForm::submitForm() method was used for this form.'));
- $form_state['redirect'] = '';
+ $form_state['redirect_route']['route_name'] = '<front>';
}
}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php
index 3852ea8..b85d3fb 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php
@@ -452,7 +452,10 @@ class OverviewTerms extends FormBase {
* Redirects to confirmation form for the reset action.
*/
public function submitReset(array &$form, array &$form_state) {
- $form_state['redirect'] = 'admin/structure/taxonomy/manage/' . $form_state['taxonomy']['vocabulary']->id() . '/reset';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'taxonomy.vocabulary_reset',
+ 'route_parameters' => array('taxonomy_vocabulary' => $form_state['taxonomy']['vocabulary']->id()),
+ );
}
}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/TermDeleteForm.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/TermDeleteForm.php
index cec3c3c..b9d810d 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/TermDeleteForm.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/TermDeleteForm.php
@@ -67,7 +67,7 @@ class TermDeleteForm extends ContentEntityConfirmFormBase {
drupal_set_message($this->t('Deleted term %name.', array('%name' => $this->entity->label())));
watchdog('taxonomy', 'Deleted term %name.', array('%name' => $this->entity->label()), WATCHDOG_NOTICE);
- $form_state['redirect'] = 'admin/structure/taxonomy';
+ $form_state['redirect_route']['route_name'] = 'taxonomy.vocabulary_list';
Cache::invalidateTags(array('content' => TRUE));
}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyDeleteForm.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyDeleteForm.php
index a2cf2ef..8032901 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyDeleteForm.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyDeleteForm.php
@@ -59,7 +59,7 @@ class VocabularyDeleteForm extends EntityConfirmFormBase {
$this->entity->delete();
drupal_set_message($this->t('Deleted vocabulary %name.', array('%name' => $this->entity->label())));
watchdog('taxonomy', 'Deleted vocabulary %name.', array('%name' => $this->entity->label()), WATCHDOG_NOTICE);
- $form_state['redirect'] = 'admin/structure/taxonomy';
+ $form_state['redirect_route']['route_name'] = 'taxonomy.vocabulary_list';
Cache::invalidateTags(array('content' => TRUE));
}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyResetForm.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyResetForm.php
index e735800..9f9e255 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyResetForm.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyResetForm.php
@@ -89,7 +89,10 @@ class VocabularyResetForm extends EntityConfirmFormBase {
$this->termStorage->resetWeights($this->entity->id());
drupal_set_message($this->t('Reset vocabulary %name to alphabetical order.', array('%name' => $this->entity->label())));
watchdog('taxonomy', 'Reset vocabulary %name to alphabetical order.', array('%name' => $this->entity->label()), WATCHDOG_NOTICE);
- $form_state['redirect'] = 'admin/structure/taxonomy/manage/' . $this->entity->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'taxonomy.vocabulary_edit',
+ 'route_parameters' => array('taxonomy_vocabulary' => $this->entity->id()),
+ );
}
}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php
index 0dbaf63..c6692aa 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php
@@ -237,7 +237,11 @@ class TermFormController extends ContentEntityFormController {
if ($this->getRequest()->query->has('destination')) {
$destination = drupal_get_destination();
}
- $form_state['redirect'] = array('taxonomy/term/' . $this->entity->id() . '/delete', array('query' => $destination));
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'taxonomy.term_delete',
+ 'route_parameters' => array('taxonomy_term' => $this->entity->id()),
+ 'options' => array('query' => $destination),
+ );
}
}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php
index 0a1537b..05ffbf4 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php
@@ -132,13 +132,16 @@ class VocabularyFormController extends EntityFormController {
case SAVED_NEW:
drupal_set_message($this->t('Created new vocabulary %name.', array('%name' => $vocabulary->name)));
watchdog('taxonomy', 'Created new vocabulary %name.', array('%name' => $vocabulary->name), WATCHDOG_NOTICE, l($this->t('edit'), 'admin/structure/taxonomy/manage/' . $vocabulary->id() . '/edit'));
- $form_state['redirect'] = 'admin/structure/taxonomy/manage/' . $vocabulary->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'taxonomy.overview_terms',
+ 'route_parameters' => array('taxonomy_vocabulary' => $vocabulary->id()),
+ );
break;
case SAVED_UPDATED:
drupal_set_message($this->t('Updated vocabulary %name.', array('%name' => $vocabulary->name)));
watchdog('taxonomy', 'Updated vocabulary %name.', array('%name' => $vocabulary->name), WATCHDOG_NOTICE, l($this->t('edit'), 'admin/structure/taxonomy/manage/' . $vocabulary->id() . '/edit'));
- $form_state['redirect'] = 'admin/structure/taxonomy';
+ $form_state['redirect_route']['route_name'] = 'taxonomy.vocabulary_list';
break;
}
@@ -151,7 +154,10 @@ class VocabularyFormController extends EntityFormController {
*/
public function delete(array $form, array &$form_state) {
$vocabulary = $this->getEntity($form_state);
- $form_state['redirect'] = array('admin/structure/taxonomy/manage/' . $vocabulary->id() . '/delete');
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'taxonomy.vocabulary_delete',
+ 'route_parameters' => array('taxonomy_vocabulary' => $vocabulary->id()),
+ );
}
}
diff --git a/core/modules/user/lib/Drupal/user/Form/UserCancelForm.php b/core/modules/user/lib/Drupal/user/Form/UserCancelForm.php
index 59d6145..e1a3c6a 100644
--- a/core/modules/user/lib/Drupal/user/Form/UserCancelForm.php
+++ b/core/modules/user/lib/Drupal/user/Form/UserCancelForm.php
@@ -159,7 +159,7 @@ class UserCancelForm extends ContentEntityConfirmFormBase {
if ($this->currentUser()->hasPermission('administer users') && empty($form_state['values']['user_cancel_confirm']) && $this->entity->id() != $this->currentUser()->id()) {
user_cancel($form_state['values'], $this->entity->id(), $form_state['values']['user_cancel_method']);
- $form_state['redirect'] = 'admin/people';
+ $form_state['redirect_route']['route_name'] = 'user.admin_account';
}
else {
// Store cancelling method and whether to notify the user in
@@ -171,7 +171,10 @@ class UserCancelForm extends ContentEntityConfirmFormBase {
drupal_set_message($this->t('A confirmation request to cancel your account has been sent to your e-mail address.'));
watchdog('user', 'Sent account cancellation request to %name %email.', array('%name' => $this->entity->label(), '%email' => '<' . $this->entity->getEmail() . '>'), WATCHDOG_NOTICE);
- $form_state['redirect'] = 'user/' . $this->entity->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'user.view',
+ 'route_parameters' => array('user' => $this->entity->id()),
+ );
}
}
diff --git a/core/modules/user/lib/Drupal/user/Form/UserLoginForm.php b/core/modules/user/lib/Drupal/user/Form/UserLoginForm.php
index b01887b..aa0228d 100644
--- a/core/modules/user/lib/Drupal/user/Form/UserLoginForm.php
+++ b/core/modules/user/lib/Drupal/user/Form/UserLoginForm.php
@@ -104,7 +104,10 @@ class UserLoginForm extends FormBase {
*/
public function submitForm(array &$form, array &$form_state) {
$account = $this->userStorage->load($form_state['uid']);
- $form_state['redirect'] = 'user/' . $account->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'user.view',
+ 'route_parameters' => array('user' => $account->id()),
+ );
user_login_finalize($account);
}
diff --git a/core/modules/user/lib/Drupal/user/Form/UserMultipleCancelConfirm.php b/core/modules/user/lib/Drupal/user/Form/UserMultipleCancelConfirm.php
index 0310d41..ba85502 100644
--- a/core/modules/user/lib/Drupal/user/Form/UserMultipleCancelConfirm.php
+++ b/core/modules/user/lib/Drupal/user/Form/UserMultipleCancelConfirm.php
@@ -210,7 +210,7 @@ class UserMultipleCancelConfirm extends ConfirmFormBase {
}
}
}
- $form_state['redirect'] = 'admin/people';
+ $form_state['redirect_route']['route_name'] = 'user.admin_account';
}
}
diff --git a/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php b/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php
index e519b8e..af22943 100644
--- a/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php
+++ b/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php
@@ -137,7 +137,7 @@ class UserPasswordForm extends FormBase {
drupal_set_message($this->t('Further instructions have been sent to your e-mail address.'));
}
- $form_state['redirect'] = 'user';
+ $form_state['redirect_route']['route_name'] = 'user.page';
}
}
diff --git a/core/modules/user/lib/Drupal/user/Form/UserRoleDelete.php b/core/modules/user/lib/Drupal/user/Form/UserRoleDelete.php
index 5aca6c7..bbb3614 100644
--- a/core/modules/user/lib/Drupal/user/Form/UserRoleDelete.php
+++ b/core/modules/user/lib/Drupal/user/Form/UserRoleDelete.php
@@ -44,7 +44,7 @@ class UserRoleDelete extends EntityConfirmFormBase {
$this->entity->delete();
watchdog('user', 'Role %name has been deleted.', array('%name' => $this->entity->label()));
drupal_set_message($this->t('Role %name has been deleted.', array('%name' => $this->entity->label())));
- $form_state['redirect'] = 'admin/people/roles';
+ $form_state['redirect_route']['route_name'] = 'user.role_list';
}
}
diff --git a/core/modules/user/lib/Drupal/user/ProfileFormController.php b/core/modules/user/lib/Drupal/user/ProfileFormController.php
index ee4f8c3..3c36981 100644
--- a/core/modules/user/lib/Drupal/user/ProfileFormController.php
+++ b/core/modules/user/lib/Drupal/user/ProfileFormController.php
@@ -61,7 +61,11 @@ class ProfileFormController extends AccountFormController {
$query->remove('destination');
}
// We redirect from user/%/edit to user/%/cancel to make the tabs disappear.
- $form_state['redirect'] = array('user/' . $this->entity->id() . '/cancel', array('query' => $destination));
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'user.cancel',
+ 'route_parameters' => array('user' => $this->entity->id()),
+ 'options' => array('query' => $destination),
+ );
}
}
diff --git a/core/modules/user/lib/Drupal/user/RegisterFormController.php b/core/modules/user/lib/Drupal/user/RegisterFormController.php
index 6ace140..38612a2 100644
--- a/core/modules/user/lib/Drupal/user/RegisterFormController.php
+++ b/core/modules/user/lib/Drupal/user/RegisterFormController.php
@@ -116,7 +116,7 @@ class RegisterFormController extends AccountFormController {
_user_mail_notify('register_no_approval_required', $account);
user_login_finalize($account);
drupal_set_message($this->t('Registration successful. You are now logged in.'));
- $form_state['redirect'] = '';
+ $form_state['redirect_route']['route_name'] = '<front>';
}
// No administrator approval required.
elseif ($account->isActive() || $notify) {
@@ -131,7 +131,7 @@ class RegisterFormController extends AccountFormController {
}
else {
drupal_set_message($this->t('A welcome message with further instructions has been sent to your e-mail address.'));
- $form_state['redirect'] = '';
+ $form_state['redirect_route']['route_name'] = '<front>';
}
}
}
@@ -140,7 +140,7 @@ class RegisterFormController extends AccountFormController {
else {
_user_mail_notify('register_pending_approval', $account);
drupal_set_message($this->t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.<br />In the meantime, a welcome message with further instructions has been sent to your e-mail address.'));
- $form_state['redirect'] = '';
+ $form_state['redirect_route']['route_name'] = '<front>';
}
}
}
diff --git a/core/modules/user/lib/Drupal/user/RoleFormController.php b/core/modules/user/lib/Drupal/user/RoleFormController.php
index edb242e..01076dd 100644
--- a/core/modules/user/lib/Drupal/user/RoleFormController.php
+++ b/core/modules/user/lib/Drupal/user/RoleFormController.php
@@ -75,14 +75,17 @@ class RoleFormController extends EntityFormController {
drupal_set_message($this->t('Role %label has been added.', array('%label' => $entity->label())));
watchdog('user', 'Role %label has been added.', array('%label' => $entity->label()), WATCHDOG_NOTICE, l($this->t('Edit'), $uri['path']));
}
- $form_state['redirect'] = 'admin/people/roles';
+ $form_state['redirect_route']['route_name'] = 'user.role_list';
}
/**
* {@inheritdoc}
*/
public function delete(array $form, array &$form_state) {
- $form_state['redirect'] = 'admin/people/roles/manage/' . $this->entity->id() . '/delete';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'user.role_delete',
+ 'route_parameters' => array('user_role' => $this->entity->id()),
+ );
}
}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Analyze.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Analyze.php
index 6214e9b..cc798fe 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Analyze.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Analyze.php
@@ -58,7 +58,10 @@ class Analyze extends ViewsFormBase {
* {@inheritdoc}
*/
public function submitForm(array &$form, array &$form_state) {
- $form_state['redirect'] = 'admin/structure/views/view/' . $form_state['view']->id() . '/edit';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'views_ui.edit',
+ 'route_parameters' => array('view' => $form_state['view']->id()),
+ );
}
}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/BreakLockForm.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/BreakLockForm.php
index 646488d..8d0b48d 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Form/BreakLockForm.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/BreakLockForm.php
@@ -116,7 +116,10 @@ class BreakLockForm extends EntityConfirmFormBase {
*/
public function submit(array $form, array &$form_state) {
$this->tempStore->delete($this->entity->id());
- $form_state['redirect'] = 'admin/structure/views/view/' . $this->entity->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'views_ui.edit',
+ 'route_parameters' => array('view' => $this->entity->id()),
+ );
drupal_set_message($this->t('The lock has been broken and you may now edit this view.'));
}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php
index 6bd5439..5e65fd94 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php
@@ -195,12 +195,15 @@ class ViewAddFormController extends ViewFormControllerBase {
// @todo Figure out whether it really makes sense to throw and catch exceptions on the wizard.
catch (WizardException $e) {
drupal_set_message($e->getMessage(), 'error');
- $form_state['redirect'] = 'admin/structure/views';
+ $form_state['redirect_route']['route_name'] = 'views_ui.list';
return;
}
$view->save();
- $form_state['redirect'] = array('admin/structure/views/view/' . $view->id());
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'views_ui.edit',
+ 'route_parameters' => array('view' => $view->id()),
+ );
}
/**
@@ -212,7 +215,7 @@ class ViewAddFormController extends ViewFormControllerBase {
* A reference to a keyed array containing the current state of the form.
*/
public function cancel(array $form, array &$form_state) {
- $form_state['redirect'] = 'admin/structure/views';
+ $form_state['redirect_route']['route_name'] = 'views_ui.list';
}
}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewDeleteFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewDeleteFormController.php
index 251dc6f..4580db1 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewDeleteFormController.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewDeleteFormController.php
@@ -44,7 +44,7 @@ class ViewDeleteFormController extends EntityConfirmFormBase {
parent::submit($form, $form_state);
$this->entity->delete();
- $form_state['redirect'] = 'admin/structure/views';
+ $form_state['redirect_route']['route_name'] = 'views_ui.list';
}
}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
index 5f81565f..6bb082e 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
@@ -266,7 +266,10 @@ class ViewEditFormController extends ViewFormControllerBase {
$displays[$new_id] = $displays[$id];
unset($displays[$id]);
// Redirect the user to the renamed display to be sure that the page itself exists and doesn't throw errors.
- $form_state['redirect'] = 'admin/structure/views/view/' . $view->id() . '/edit/' . $new_id;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'views_ui.edit_display',
+ 'route_parameters' => array('view' => $view->id(), 'display_id' => $id),
+ );
}
}
$view->set('display', $displays);
@@ -316,7 +319,7 @@ class ViewEditFormController extends ViewFormControllerBase {
// Remove this view from cache so edits will be lost.
$view = $this->entity;
$this->tempStore->delete($view->id());
- $form_state['redirect'] = 'admin/structure/views';
+ $form_state['redirect_route']['route_name'] = 'views_ui.list';
}
/**
@@ -563,7 +566,10 @@ class ViewEditFormController extends ViewFormControllerBase {
$view->cacheSet();
// Redirect to the top-level edit page.
- $form_state['redirect'] = 'admin/structure/views/view/' . $view->id() . '/edit/' . $id;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'views_ui.edit_display',
+ 'route_parameters' => array('view' => $view->id(), 'display_id' => $id),
+ );
}
/**
@@ -579,7 +585,10 @@ class ViewEditFormController extends ViewFormControllerBase {
$view->cacheSet();
// Redirect to the top-level edit page.
- $form_state['redirect'] = 'admin/structure/views/view/' . $view->id() . '/edit/' . $id;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'views_ui.edit_display',
+ 'route_parameters' => array('view' => $view->id(), 'display_id' => $id),
+ );
}
/**
@@ -594,7 +603,10 @@ class ViewEditFormController extends ViewFormControllerBase {
$view->cacheSet();
// Redirect to the top-level edit page.
- $form_state['redirect'] = 'admin/structure/views/view/' . $view->id() . '/edit/' . $id;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'views_ui.edit_display',
+ 'route_parameters' => array('view' => $view->id(), 'display_id' => $id),
+ );
}
/**
@@ -612,7 +624,10 @@ class ViewEditFormController extends ViewFormControllerBase {
// Redirect to the top-level edit page. The first remaining display will
// become the active display.
- $form_state['redirect'] = 'admin/structure/views/view/' . $view->id();
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'views_ui.edit',
+ 'route_parameters' => array('view' => $view->id()),
+ );
}
/**
@@ -785,7 +800,10 @@ class ViewEditFormController extends ViewFormControllerBase {
$view->cacheSet();
// Redirect to the new display's edit page.
- $form_state['redirect'] = 'admin/structure/views/view/' . $view->id() . '/edit/' . $new_display_id;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'views_ui.edit_display',
+ 'route_parameters' => array('view' => $view->id(), 'display_id' => $new_display_id),
+ );
}
/**
@@ -804,7 +822,10 @@ class ViewEditFormController extends ViewFormControllerBase {
$view->cacheSet();
// Redirect to the new display's edit page.
- $form_state['redirect'] = 'admin/structure/views/view/' . $view->id() . '/edit/' . $display_id;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'views_ui.edit_display',
+ 'route_parameters' => array('view' => $view->id(), 'display_id' => $display_id),
+ );
}
/**
@@ -837,7 +858,10 @@ class ViewEditFormController extends ViewFormControllerBase {
$view->cacheSet();
// Redirect to the new display's edit page.
- $form_state['redirect'] = 'admin/structure/views/view/' . $view->id() . '/edit/' . $new_display_id;
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'views_ui.edit_display',
+ 'route_parameters' => array('view' => $view->id(), 'display_id' => $new_display_id),
+ );
}
/**
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
index 84bfde1..61505ae 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
@@ -277,7 +277,10 @@ class ViewUI implements ViewStorageInterface {
$this->cacheSet();
}
- $form_state['redirect'] = 'admin/structure/views/view/' . $this->id() . '/edit';
+ $form_state['redirect_route'] = array(
+ 'route_name' => 'views_ui.edit',
+ 'route_parameters' => array('view' => $this->id()),
+ );
}
/**