diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index c76dc40..7af160e1 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -273,9 +273,12 @@ public function url($rel = 'canonical', $options = array()) { * An array of URI placeholders. */ protected function urlRouteParameters($rel) { - // The entity ID is needed as a route parameter. - $uri_route_parameters[$this->getEntityTypeId()] = $this->id(); + $uri_route_parameters = []; + if ($rel != 'list') { + // The entity ID is needed as a route parameter. + $uri_route_parameters[$this->getEntityTypeId()] = $this->id(); + } return $uri_route_parameters; } diff --git a/core/modules/action/action.module b/core/modules/action/action.module index f1cde81..e44b6ba 100644 --- a/core/modules/action/action.module +++ b/core/modules/action/action.module @@ -45,5 +45,6 @@ function action_entity_type_build(array &$entity_types) { ->setFormClass('delete', 'Drupal\action\Form\ActionDeleteForm') ->setListBuilderClass('Drupal\action\ActionListBuilder') ->setLinkTemplate('delete-form', 'entity.action.delete_form') - ->setLinkTemplate('edit-form', 'entity.action.edit_form'); + ->setLinkTemplate('edit-form', 'entity.action.edit_form') + ->setLinkTemplate('list', 'entity.action.edit_form'); } diff --git a/core/modules/block_content/src/BlockContentForm.php b/core/modules/block_content/src/BlockContentForm.php index 6cce1c1..78946ef 100644 --- a/core/modules/block_content/src/BlockContentForm.php +++ b/core/modules/block_content/src/BlockContentForm.php @@ -198,7 +198,7 @@ public function save(array $form, FormStateInterface $form_state) { ); } else { - $form_state->setRedirect('block_content.list'); + $form_state->setRedirectUrl($block->urlInfo('list')); } } else { diff --git a/core/modules/block_content/src/BlockContentTypeForm.php b/core/modules/block_content/src/BlockContentTypeForm.php index 8cde318..bf11dfd 100644 --- a/core/modules/block_content/src/BlockContentTypeForm.php +++ b/core/modules/block_content/src/BlockContentTypeForm.php @@ -107,7 +107,7 @@ public function save(array $form, FormStateInterface $form_state) { $logger->notice('Custom block type %label has been added.', array('%label' => $block_type->label(), 'link' => $edit_link)); } - $form_state->setRedirect('block_content.type_list'); + $form_state->setRedirectUrl($this->entity->urlInfo('list')); } } diff --git a/core/modules/block_content/src/Entity/BlockContent.php b/core/modules/block_content/src/Entity/BlockContent.php index 4908d95..0057e46 100644 --- a/core/modules/block_content/src/Entity/BlockContent.php +++ b/core/modules/block_content/src/Entity/BlockContent.php @@ -42,6 +42,7 @@ * "canonical" = "entity.block_content.canonical", * "delete-form" = "entity.block_content.delete_form", * "edit-form" = "entity.block_content.canonical", + * "list" = "block_content.list", * }, * translatable = TRUE, * entity_keys = { diff --git a/core/modules/block_content/src/Entity/BlockContentType.php b/core/modules/block_content/src/Entity/BlockContentType.php index fa1aba1..142cbef 100644 --- a/core/modules/block_content/src/Entity/BlockContentType.php +++ b/core/modules/block_content/src/Entity/BlockContentType.php @@ -36,7 +36,8 @@ * }, * links = { * "delete-form" = "entity.block_content_type.delete_form", - * "edit-form" = "entity.block_content_type.edit_form" + * "edit-form" = "entity.block_content_type.edit_form", + * "list" = "block_content.list", * } * ) */ diff --git a/core/modules/block_content/src/Form/BlockContentDeleteForm.php b/core/modules/block_content/src/Form/BlockContentDeleteForm.php index 1d7724d..39c1802 100644 --- a/core/modules/block_content/src/Form/BlockContentDeleteForm.php +++ b/core/modules/block_content/src/Form/BlockContentDeleteForm.php @@ -58,7 +58,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $this->entity->delete(); drupal_set_message($this->t('Custom block %label has been deleted.', array('%label' => $this->entity->label()))); $this->logger('block_content')->notice('Custom block %label has been deleted.', array('%label' => $this->entity->label())); - $form_state->setRedirect('block_content.list'); + $form_state->setRedirectUrl($this->entity->urlInfo('list')); } } diff --git a/core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php b/core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php index 65fe352..87a0f8b 100644 --- a/core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php +++ b/core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php @@ -55,7 +55,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('block_content.type_list'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/comment/src/CommentTypeForm.php b/core/modules/comment/src/CommentTypeForm.php index db9361a..151c0f7 100644 --- a/core/modules/comment/src/CommentTypeForm.php +++ b/core/modules/comment/src/CommentTypeForm.php @@ -173,7 +173,7 @@ public function save(array $form, FormStateInterface $form_state) { $this->logger->notice('Comment type %label has been added.', array('%label' => $comment_type->label(), 'link' => $edit_link)); } - $form_state->setRedirect('comment.type_list'); + $form_state->setRedirectUrl($comment_type->urlInfo('list')); } } diff --git a/core/modules/comment/src/Entity/CommentType.php b/core/modules/comment/src/Entity/CommentType.php index 8c36b22..e0c6bf8 100644 --- a/core/modules/comment/src/Entity/CommentType.php +++ b/core/modules/comment/src/Entity/CommentType.php @@ -36,7 +36,8 @@ * links = { * "delete-form" = "entity.comment_type.delete_form", * "edit-form" = "entity.comment_type.edit_form", - * "add-form" = "entity.comment_type.add_form" + * "add-form" = "entity.comment_type.add_form", + * "list" = "comment.type_list", * } * ) */ diff --git a/core/modules/comment/src/Form/CommentTypeDeleteForm.php b/core/modules/comment/src/Form/CommentTypeDeleteForm.php index 7ac7ce7..02a27ba 100644 --- a/core/modules/comment/src/Form/CommentTypeDeleteForm.php +++ b/core/modules/comment/src/Form/CommentTypeDeleteForm.php @@ -99,7 +99,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('comment.type_list'); + return $this->entity->urlInfo('list'); } /** @@ -143,7 +143,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->entity->delete(); - $form_state->setRedirect('comment.type_list'); + $form_state->setRedirectUrl($this->entity->urlInfo('list')); drupal_set_message($this->t('Comment type %label has been deleted.', array('%label' => $this->entity->label()))); $this->logger->notice('comment type %label has been deleted.', array('%label' => $this->entity->label())); } diff --git a/core/modules/config/tests/config_test/src/ConfigTestController.php b/core/modules/config/tests/config_test/src/ConfigTestController.php index cb62642..fe27a96 100644 --- a/core/modules/config/tests/config_test/src/ConfigTestController.php +++ b/core/modules/config/tests/config_test/src/ConfigTestController.php @@ -41,7 +41,7 @@ public function editTitle(ConfigTest $config_test) { */ function enable(ConfigTest $config_test) { $config_test->enable()->save(); - return new RedirectResponse($this->url('config_test.list_page', array(), array('absolute' => TRUE))); + return new RedirectResponse($config_test->url('list', array('absolute' => TRUE))); } /** @@ -55,7 +55,7 @@ function enable(ConfigTest $config_test) { */ function disable(ConfigTest $config_test) { $config_test->disable()->save(); - return new RedirectResponse(\Drupal::url('config_test.list_page', array(), array('absolute' => TRUE))); + return new RedirectResponse($config_test->url('list', array('absolute' => TRUE))); } } diff --git a/core/modules/config/tests/config_test/src/ConfigTestForm.php b/core/modules/config/tests/config_test/src/ConfigTestForm.php index cb847ee..27f65dc 100644 --- a/core/modules/config/tests/config_test/src/ConfigTestForm.php +++ b/core/modules/config/tests/config_test/src/ConfigTestForm.php @@ -81,7 +81,7 @@ public function save(array $form, FormStateInterface $form_state) { drupal_set_message(format_string('%label configuration has been created.', array('%label' => $entity->label()))); } - $form_state->setRedirect('config_test.list_page'); + $form_state->setRedirectUrl($this->entity->urlInfo('list')); } } diff --git a/core/modules/config/tests/config_test/src/Entity/ConfigTest.php b/core/modules/config/tests/config_test/src/Entity/ConfigTest.php index ae56360..01624e2 100644 --- a/core/modules/config/tests/config_test/src/Entity/ConfigTest.php +++ b/core/modules/config/tests/config_test/src/Entity/ConfigTest.php @@ -37,7 +37,8 @@ * "edit-form" = "entity.config_test.edit_form", * "delete-form" = "entity.config_test.delete_form", * "enable" = "entity.config_test.enable", - * "disable" = "entity.config_test.disable" + * "disable" = "entity.config_test.disable", + * "list" = "config_test.list_page", * } * ) */ diff --git a/core/modules/config/tests/config_test/src/Form/ConfigTestDeleteForm.php b/core/modules/config/tests/config_test/src/Form/ConfigTestDeleteForm.php index 76fc67e..b2c791d 100644 --- a/core/modules/config/tests/config_test/src/Form/ConfigTestDeleteForm.php +++ b/core/modules/config/tests/config_test/src/Form/ConfigTestDeleteForm.php @@ -34,7 +34,7 @@ public function getConfirmText() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('config_test.list_page'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/contact/src/ContactFormEditForm.php b/core/modules/contact/src/ContactFormEditForm.php index 123ba38..dbf9128 100644 --- a/core/modules/contact/src/ContactFormEditForm.php +++ b/core/modules/contact/src/ContactFormEditForm.php @@ -119,7 +119,7 @@ public function save(array $form, FormStateInterface $form_state) { ->save(); } - $form_state->setRedirect('contact.form_list'); + $form_state->setRedirectUrl($contact_form->urlInfo('list')); } } diff --git a/core/modules/contact/src/Entity/ContactForm.php b/core/modules/contact/src/Entity/ContactForm.php index 2dd7ce3..e702409 100644 --- a/core/modules/contact/src/Entity/ContactForm.php +++ b/core/modules/contact/src/Entity/ContactForm.php @@ -35,7 +35,8 @@ * }, * links = { * "delete-form" = "entity.contact_form.delete_form", - * "edit-form" = "entity.contact_form.edit_form" + * "edit-form" = "entity.contact_form.edit_form", + * "list" = "contact.form_list", * } * ) */ diff --git a/core/modules/contact/src/Form/ContactFormDeleteForm.php b/core/modules/contact/src/Form/ContactFormDeleteForm.php index a036f2e..3d19233 100644 --- a/core/modules/contact/src/Form/ContactFormDeleteForm.php +++ b/core/modules/contact/src/Form/ContactFormDeleteForm.php @@ -27,7 +27,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('contact.form_list'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index bdd492a..515fadc 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -88,6 +88,7 @@ function field_ui_entity_type_build(array &$entity_types) { $entity_types['field_config']->setFormClass('delete', 'Drupal\field_ui\Form\FieldConfigDeleteForm'); $entity_types['field_config']->setListBuilderClass('Drupal\field_ui\FieldConfigListBuilder'); $entity_types['field_storage_config']->setListBuilderClass('Drupal\field_ui\FieldStorageConfigListBuilder'); + $entity_types['field_storage_config']->setLinkTemplate('link', 'field_ui.list'); foreach ($entity_types as $entity_type) { if ($bundle = $entity_type->getBundleOf()) { @@ -302,6 +303,7 @@ function field_ui_entity_type_alter(array &$entity_types) { $form_mode->set('admin_permission', 'administer display modes'); $form_mode->setLinkTemplate('delete-form', 'field_ui.entity_form_mode.delete_form'); $form_mode->setLinkTemplate('edit-form', 'field_ui.entity_form_mode.edit_form'); + $form_mode->setLinkTemplate('list', 'field_ui.entity_form_mode_list'); $view_mode = $entity_types['entity_view_mode']; $view_mode->setListBuilderClass('Drupal\field_ui\EntityDisplayModeListBuilder'); @@ -311,4 +313,5 @@ function field_ui_entity_type_alter(array &$entity_types) { $view_mode->set('admin_permission', 'administer display modes'); $view_mode->setLinkTemplate('delete-form', 'field_ui.entity_view_mode.delete_form'); $view_mode->setLinkTemplate('edit-form', 'field_ui.entity_view_mode.edit_form'); + $view_mode->setLinkTemplate('list', 'field_ui.entity_view_mode_list'); } diff --git a/core/modules/image/src/Entity/ImageStyle.php b/core/modules/image/src/Entity/ImageStyle.php index a57904d..1179fd5 100644 --- a/core/modules/image/src/Entity/ImageStyle.php +++ b/core/modules/image/src/Entity/ImageStyle.php @@ -46,7 +46,8 @@ * links = { * "flush-form" = "entity.image_style.flush_form", * "edit-form" = "entity.image_style.edit_form", - * "delete-form" = "entity.image_style.delete_form" + * "delete-form" = "entity.image_style.delete_form", + * "list" = "image.style_list", * } * ) */ diff --git a/core/modules/image/src/Form/ImageStyleDeleteForm.php b/core/modules/image/src/Form/ImageStyleDeleteForm.php index 65dddac..47ed112 100644 --- a/core/modules/image/src/Form/ImageStyleDeleteForm.php +++ b/core/modules/image/src/Form/ImageStyleDeleteForm.php @@ -34,7 +34,7 @@ public function getConfirmText() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('image.style_list'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/image/src/Form/ImageStyleFlushForm.php b/core/modules/image/src/Form/ImageStyleFlushForm.php index d5f0ea5..5d8a5a7 100644 --- a/core/modules/image/src/Form/ImageStyleFlushForm.php +++ b/core/modules/image/src/Form/ImageStyleFlushForm.php @@ -41,7 +41,7 @@ public function getConfirmText() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('image.style_list'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/language/src/Entity/ConfigurableLanguage.php b/core/modules/language/src/Entity/ConfigurableLanguage.php index 9a766d7..5c9a0cd 100644 --- a/core/modules/language/src/Entity/ConfigurableLanguage.php +++ b/core/modules/language/src/Entity/ConfigurableLanguage.php @@ -39,7 +39,8 @@ * }, * links = { * "delete-form" = "entity.configurable_language.delete_form", - * "edit-form" = "entity.configurable_language.edit_form" + * "edit-form" = "entity.configurable_language.edit_form", + * "list" = "language.admin_overview", * } * ) */ diff --git a/core/modules/language/src/Form/LanguageAddForm.php b/core/modules/language/src/Form/LanguageAddForm.php index 93f1445..d84dcf1 100644 --- a/core/modules/language/src/Form/LanguageAddForm.php +++ b/core/modules/language/src/Form/LanguageAddForm.php @@ -97,7 +97,7 @@ public function save(array $form, FormStateInterface $form_state) { // 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 block administration page.', array('@block-admin' => $this->url('block.admin_display')))); } - $form_state->setRedirect('language.admin_overview'); + $form_state->setRedirectUrl($this->entity->urlInfo('list')); } /** diff --git a/core/modules/language/src/Form/LanguageDeleteForm.php b/core/modules/language/src/Form/LanguageDeleteForm.php index 32fb889..a565ea9 100644 --- a/core/modules/language/src/Form/LanguageDeleteForm.php +++ b/core/modules/language/src/Form/LanguageDeleteForm.php @@ -58,7 +58,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('language.admin_overview'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/language/src/Form/LanguageEditForm.php b/core/modules/language/src/Form/LanguageEditForm.php index 58b9951..e59d6d7 100644 --- a/core/modules/language/src/Form/LanguageEditForm.php +++ b/core/modules/language/src/Form/LanguageEditForm.php @@ -49,7 +49,7 @@ public function actions(array $form, FormStateInterface $form_state) { */ public function save(array $form, FormStateInterface $form_state) { parent::save($form, $form_state); - $form_state->setRedirect('language.admin_overview'); + $form_state->setRedirectUrl($this->entity->urlInfo('list')); $this->logger('language')->notice('The %language (%langcode) language has been updated.', array('%language' => $this->entity->label(), '%langcode' => $this->entity->id())); } diff --git a/core/modules/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module index 7d4145a..4a48d29 100644 --- a/core/modules/menu_ui/menu_ui.module +++ b/core/modules/menu_ui/menu_ui.module @@ -66,7 +66,8 @@ function menu_ui_entity_type_build(array &$entity_types) { ->setLinkTemplate('add-form', 'entity.menu.add_form') ->setLinkTemplate('delete-form', 'entity.menu.delete_form') ->setLinkTemplate('edit-form', 'entity.menu.edit_form') - ->setLinkTemplate('add-link-form', 'entity.menu.add_link_form'); + ->setLinkTemplate('add-link-form', 'entity.menu.add_link_form') + ->setLinkTemplate('list', 'menu_ui.overview_page'); } /** diff --git a/core/modules/menu_ui/src/Form/MenuDeleteForm.php b/core/modules/menu_ui/src/Form/MenuDeleteForm.php index 2d72b84..bf99b3e 100644 --- a/core/modules/menu_ui/src/Form/MenuDeleteForm.php +++ b/core/modules/menu_ui/src/Form/MenuDeleteForm.php @@ -93,7 +93,7 @@ public function getConfirmText() { * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { - $form_state->setRedirect('menu_ui.overview_page'); + $form_state->setRedirectUrl($this->entity->urlInfo('list')); // Locked menus may not be deleted. if ($this->entity->isLocked()) { diff --git a/core/modules/node/src/Entity/NodeType.php b/core/modules/node/src/Entity/NodeType.php index e33c1ec..001df87 100644 --- a/core/modules/node/src/Entity/NodeType.php +++ b/core/modules/node/src/Entity/NodeType.php @@ -36,7 +36,8 @@ * }, * links = { * "edit-form" = "entity.node_type.edit_form", - * "delete-form" = "entity.node_type.delete_form" + * "delete-form" = "entity.node_type.delete_form", + * "list" = "node.overview_types" * } * ) */ diff --git a/core/modules/node/src/Form/NodeTypeDeleteConfirm.php b/core/modules/node/src/Form/NodeTypeDeleteConfirm.php index 0242301..dbe002f 100644 --- a/core/modules/node/src/Form/NodeTypeDeleteConfirm.php +++ b/core/modules/node/src/Form/NodeTypeDeleteConfirm.php @@ -55,7 +55,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('node.overview_types'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/node/src/NodeTypeForm.php b/core/modules/node/src/NodeTypeForm.php index 8a0f2a6..2e6427f 100644 --- a/core/modules/node/src/NodeTypeForm.php +++ b/core/modules/node/src/NodeTypeForm.php @@ -233,7 +233,7 @@ public function save(array $form, FormStateInterface $form_state) { elseif ($status == SAVED_NEW) { node_add_body_field($type); drupal_set_message(t('The content type %name has been added.', $t_args)); - $context = array_merge($t_args, array('link' => $this->l(t('View'), new Url('node.overview_types')))); + $context = array_merge($t_args, array('link' => $type->link($this->t('View'), 'list'))); $this->logger('node')->notice('Added content type %name.', $context); } @@ -256,7 +256,7 @@ public function save(array $form, FormStateInterface $form_state) { } $this->entityManager->clearCachedFieldDefinitions(); - $form_state->setRedirect('node.overview_types'); + $form_state->setRedirectUrl($type->urlInfo('list')); } } diff --git a/core/modules/responsive_image/src/Entity/ResponsiveImageMapping.php b/core/modules/responsive_image/src/Entity/ResponsiveImageMapping.php index 3e8440e..370a4b3 100644 --- a/core/modules/responsive_image/src/Entity/ResponsiveImageMapping.php +++ b/core/modules/responsive_image/src/Entity/ResponsiveImageMapping.php @@ -34,7 +34,8 @@ * }, * links = { * "edit-form" = "entity.responsive_image_mapping.edit_form", - * "duplicate-form" = "entity.responsive_image_mapping.duplicate_form" + * "duplicate-form" = "entity.responsive_image_mapping.duplicate_form", + * "list" = "responsive_image.mapping_page", * } * ) */ diff --git a/core/modules/responsive_image/src/Form/ResponsiveImageMappingDeleteForm.php b/core/modules/responsive_image/src/Form/ResponsiveImageMappingDeleteForm.php index d5526b5..acf486d 100644 --- a/core/modules/responsive_image/src/Form/ResponsiveImageMappingDeleteForm.php +++ b/core/modules/responsive_image/src/Form/ResponsiveImageMappingDeleteForm.php @@ -24,7 +24,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('responsive_image.mapping_page'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/responsive_image/src/ResponsiveImageMappingForm.php b/core/modules/responsive_image/src/ResponsiveImageMappingForm.php index 0ad61ca..a6057cc 100644 --- a/core/modules/responsive_image/src/ResponsiveImageMappingForm.php +++ b/core/modules/responsive_image/src/ResponsiveImageMappingForm.php @@ -162,7 +162,7 @@ public function save(array $form, FormStateInterface $form_state) { ); } else { - $form_state->setRedirect('responsive_image.mapping_page'); + $form_state->setRedirectUrl($this->entity->urlInfo('list')); } } diff --git a/core/modules/search/src/Controller/SearchController.php b/core/modules/search/src/Controller/SearchController.php index 4e79f79..4e3d065 100644 --- a/core/modules/search/src/Controller/SearchController.php +++ b/core/modules/search/src/Controller/SearchController.php @@ -191,7 +191,8 @@ public function performOperation(SearchPageInterface $search_page, $op) { drupal_set_message($this->t('The %label search page has been disabled.', array('%label' => $search_page->label()))); } - return $this->redirect('search.settings'); + $url = $search_page->urlInfo('list'); + return $this->redirect($url->getRouteName(), $url->getRouteParameters()); } /** diff --git a/core/modules/search/src/Entity/SearchPage.php b/core/modules/search/src/Entity/SearchPage.php index c2d0794..261d92c 100644 --- a/core/modules/search/src/Entity/SearchPage.php +++ b/core/modules/search/src/Entity/SearchPage.php @@ -39,7 +39,8 @@ * "delete-form" = "entity.search_page.delete_form", * "enable" = "entity.search_page.enable", * "disable" = "entity.search_page.disable", - * "set-default" = "entity.search_page.set_default" + * "set-default" = "entity.search_page.set_default", + * "list" = "search.settings", * }, * config_prefix = "page", * entity_keys = { diff --git a/core/modules/search/src/Form/SearchPageDeleteForm.php b/core/modules/search/src/Form/SearchPageDeleteForm.php index 5518d59..aae80c4 100644 --- a/core/modules/search/src/Form/SearchPageDeleteForm.php +++ b/core/modules/search/src/Form/SearchPageDeleteForm.php @@ -27,7 +27,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('search.settings'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/search/src/Form/SearchPageFormBase.php b/core/modules/search/src/Form/SearchPageFormBase.php index c2aa6ed..599812c 100644 --- a/core/modules/search/src/Form/SearchPageFormBase.php +++ b/core/modules/search/src/Form/SearchPageFormBase.php @@ -179,7 +179,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { public function save(array $form, FormStateInterface $form_state) { $this->entity->save(); - $form_state->setRedirect('search.settings'); + $form_state->setRedirectUrl($this->entity->urlInfo('list')); } } diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index ba9c43d..917f2f4 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -373,7 +373,7 @@ function shortcut_toolbar() { 'tab' => array( '#type' => 'link', '#title' => t('Shortcuts'), - '#url' => Url::fromRoute('shortcut.set_admin'), + '#url' => $shortcut_set->urlInfo('list'), '#attributes' => array( 'title' => t('Shortcuts'), 'class' => array('toolbar-icon', 'toolbar-icon-shortcut'), diff --git a/core/modules/shortcut/src/Entity/ShortcutSet.php b/core/modules/shortcut/src/Entity/ShortcutSet.php index f72b7d0..938a32f 100644 --- a/core/modules/shortcut/src/Entity/ShortcutSet.php +++ b/core/modules/shortcut/src/Entity/ShortcutSet.php @@ -38,7 +38,8 @@ * links = { * "customize-form" = "entity.shortcut_set.customize_form", * "delete-form" = "entity.shortcut_set.delete_form", - * "edit-form" = "entity.shortcut_set.edit_form" + * "edit-form" = "entity.shortcut_set.edit_form", + * "list" = "shortcut.set_admin", * } * ) */ diff --git a/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php b/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php index 4ab3448..3d2b310 100644 --- a/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php +++ b/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php @@ -103,7 +103,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->entity->delete(); - $form_state->setRedirect('shortcut.set_admin'); + $form_state->setRedirectUrl($this->entity->urlInfo('list')); drupal_set_message(t('The shortcut set %title has been deleted.', array('%title' => $this->entity->label()))); } diff --git a/core/modules/system/src/Form/DateFormatDeleteForm.php b/core/modules/system/src/Form/DateFormatDeleteForm.php index 0cb8729..2dc6850 100644 --- a/core/modules/system/src/Form/DateFormatDeleteForm.php +++ b/core/modules/system/src/Form/DateFormatDeleteForm.php @@ -65,7 +65,7 @@ public function getConfirmText() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('system.date_format_list'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/system/src/Form/DateFormatFormBase.php b/core/modules/system/src/Form/DateFormatFormBase.php index cb2fde2..6e1c837 100644 --- a/core/modules/system/src/Form/DateFormatFormBase.php +++ b/core/modules/system/src/Form/DateFormatFormBase.php @@ -174,7 +174,6 @@ public function validate(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { - $form_state->setRedirect('system.date_format_list'); $form_state->setValue('pattern', trim($form_state->getValue('date_format_pattern'))); parent::submitForm($form, $form_state); } @@ -190,6 +189,7 @@ public function save(array $form, FormStateInterface $form_state) { else { drupal_set_message(t('Custom date format added.')); } + $form_state->setRedirectUrl($this->entity->urlInfo('list')); } } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 8f2a8ab..e81707e 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1310,7 +1310,8 @@ function system_entity_type_build(array &$entity_types) { ->setFormClass('delete', 'Drupal\system\Form\DateFormatDeleteForm') ->setListBuilderClass('Drupal\system\DateFormatListBuilder') ->setLinkTemplate('edit-form', 'entity.date_format.edit_form') - ->setLinkTemplate('delete-form', 'entity.date_format.delete_form'); + ->setLinkTemplate('delete-form', 'entity.date_format.delete_form') + ->setLinkTemplate('list', 'system.date_format_list'); } /** diff --git a/core/modules/taxonomy/src/Entity/Vocabulary.php b/core/modules/taxonomy/src/Entity/Vocabulary.php index 6d83fa7..8284a44 100644 --- a/core/modules/taxonomy/src/Entity/Vocabulary.php +++ b/core/modules/taxonomy/src/Entity/Vocabulary.php @@ -40,7 +40,8 @@ * "delete-form" = "entity.taxonomy_vocabulary.delete_form", * "reset-form" = "entity.taxonomy_vocabulary.reset_form", * "overview-form" = "entity.taxonomy_vocabulary.overview_form", - * "edit-form" = "entity.taxonomy_vocabulary.edit_form" + * "edit-form" = "entity.taxonomy_vocabulary.edit_form", + * "list" = "taxonomy.vocabulary_list", * } * ) */ diff --git a/core/modules/taxonomy/src/Form/TermDeleteForm.php b/core/modules/taxonomy/src/Form/TermDeleteForm.php index 77a3644..7f7a13d 100644 --- a/core/modules/taxonomy/src/Form/TermDeleteForm.php +++ b/core/modules/taxonomy/src/Form/TermDeleteForm.php @@ -36,7 +36,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('taxonomy.vocabulary_list'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/taxonomy/src/Form/VocabularyDeleteForm.php b/core/modules/taxonomy/src/Form/VocabularyDeleteForm.php index 16ae285..dcc5008 100644 --- a/core/modules/taxonomy/src/Form/VocabularyDeleteForm.php +++ b/core/modules/taxonomy/src/Form/VocabularyDeleteForm.php @@ -34,7 +34,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('taxonomy.vocabulary_list'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/taxonomy/src/VocabularyForm.php b/core/modules/taxonomy/src/VocabularyForm.php index e3d0ffe..90b68be 100644 --- a/core/modules/taxonomy/src/VocabularyForm.php +++ b/core/modules/taxonomy/src/VocabularyForm.php @@ -128,7 +128,7 @@ public function save(array $form, FormStateInterface $form_state) { case SAVED_UPDATED: drupal_set_message($this->t('Updated vocabulary %name.', array('%name' => $vocabulary->label()))); $this->logger('taxonomy')->notice('Updated vocabulary %name.', array('%name' => $vocabulary->label(), 'link' => $edit_link)); - $form_state->setRedirect('taxonomy.vocabulary_list'); + $form_state->setRedirectUrl($vocabulary->urlInfo('list')); break; } diff --git a/core/modules/user/src/Entity/Role.php b/core/modules/user/src/Entity/Role.php index cad0530..5b85947 100644 --- a/core/modules/user/src/Entity/Role.php +++ b/core/modules/user/src/Entity/Role.php @@ -38,7 +38,8 @@ * links = { * "delete-form" = "entity.user_role.delete_form", * "edit-form" = "entity.user_role.edit_form", - * "edit-permissions-form" = "entity.user_role.edit_permissions_form" + * "edit-permissions-form" = "entity.user_role.edit_permissions_form", + * "list" = "user.role_list", * } * ) */ diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php index a32298e..48a0555 100644 --- a/core/modules/user/src/Entity/User.php +++ b/core/modules/user/src/Entity/User.php @@ -54,6 +54,7 @@ * "canonical" = "entity.user.canonical", * "edit-form" = "entity.user.edit_form", * "cancel-form" = "entity.user.cancel_form", + * "list" = "user.admin_account", * }, * field_ui_base_route = "entity.user.admin_form", * ) diff --git a/core/modules/user/src/Form/UserCancelForm.php b/core/modules/user/src/Form/UserCancelForm.php index 59ccf3a..7794900 100644 --- a/core/modules/user/src/Form/UserCancelForm.php +++ b/core/modules/user/src/Form/UserCancelForm.php @@ -125,7 +125,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { if ($this->currentUser()->hasPermission('administer users') && $form_state->isValueEmpty('user_cancel_confirm') && $this->entity->id() != $this->currentUser()->id()) { user_cancel($form_state->getValues(), $this->entity->id(), $form_state->getValue('user_cancel_method')); - $form_state->setRedirect('user.admin_account'); + $form_state->setRedirectUrl($this->entity->urlInfo('list')); } else { // Store cancelling method and whether to notify the user in diff --git a/core/modules/user/src/Form/UserMultipleCancelConfirm.php b/core/modules/user/src/Form/UserMultipleCancelConfirm.php index 45f340f..fb516ea 100644 --- a/core/modules/user/src/Form/UserMultipleCancelConfirm.php +++ b/core/modules/user/src/Form/UserMultipleCancelConfirm.php @@ -197,7 +197,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { } } } - $form_state->setRedirect('user.admin_account'); + $form_state->setRedirectUrl('user.admin_account'); } } diff --git a/core/modules/user/src/Form/UserRoleDelete.php b/core/modules/user/src/Form/UserRoleDelete.php index 12d9662..df16fd6 100644 --- a/core/modules/user/src/Form/UserRoleDelete.php +++ b/core/modules/user/src/Form/UserRoleDelete.php @@ -27,7 +27,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('user.role_list'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/views_ui/src/ViewDeleteForm.php b/core/modules/views_ui/src/ViewDeleteForm.php index 918b2ef..4deaada 100644 --- a/core/modules/views_ui/src/ViewDeleteForm.php +++ b/core/modules/views_ui/src/ViewDeleteForm.php @@ -27,7 +27,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('views_ui.list'); + return $this->entity->urlInfo('list'); } /** diff --git a/core/modules/views_ui/src/ViewEditForm.php b/core/modules/views_ui/src/ViewEditForm.php index e3f3924..e27d09e 100644 --- a/core/modules/views_ui/src/ViewEditForm.php +++ b/core/modules/views_ui/src/ViewEditForm.php @@ -341,7 +341,7 @@ public function cancel(array $form, FormStateInterface $form_state) { // Remove this view from cache so edits will be lost. $view = $this->entity; $this->tempStore->delete($view->id()); - $form_state->setRedirect('views_ui.list'); + $form_state->setRedirectUrl($this->entity->urlInfo('list')); } /** diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module index 7bf6e71..7c8a43d 100644 --- a/core/modules/views_ui/views_ui.module +++ b/core/modules/views_ui/views_ui.module @@ -61,7 +61,8 @@ function views_ui_entity_type_build(array &$entity_types) { ->setLinkTemplate('delete-form', 'entity.view.delete_form') ->setLinkTemplate('enable', 'entity.view.enable') ->setLinkTemplate('disable', 'entity.view.disable') - ->setLinkTemplate('break-lock-form', 'entity.view.break_lock_form'); + ->setLinkTemplate('break-lock-form', 'entity.view.break_lock_form') + ->setLinkTemplate('list', 'views_ui.list'); } /**