From ebace9e86bbb4f86fa8f41a7bfc765360ded4a8c Mon Sep 17 00:00:00 2001 From: Dries Date: Fri, 5 Sep 2014 12:35:07 -0400 Subject: [PATCH] Issue #2285413 by andypost: [Meta] Standardize entity route names. --- core/modules/action/action.module | 6 +++--- core/modules/action/action.routing.yml | 4 ++-- core/modules/contact/contact.links.task.yml | 4 ++-- core/modules/contact/contact.module | 2 +- core/modules/contact/contact.routing.yml | 2 +- .../contact/src/Plugin/views/field/ContactLink.php | 2 +- .../menu_link_content/menu_link_content.routing.yml | 2 +- .../src/Form/MenuLinkContentDeleteForm.php | 2 +- core/modules/menu_ui/menu_ui.links.action.yml | 10 +++++----- core/modules/menu_ui/menu_ui.links.contextual.yml | 4 ++-- core/modules/menu_ui/menu_ui.links.task.yml | 6 +++--- core/modules/menu_ui/menu_ui.module | 12 ++++++------ core/modules/menu_ui/menu_ui.routing.yml | 6 +++--- core/modules/menu_ui/src/Form/MenuDeleteForm.php | 2 +- core/modules/menu_ui/src/Form/MenuLinkEditForm.php | 2 +- core/modules/menu_ui/src/Form/MenuLinkResetForm.php | 2 +- core/modules/menu_ui/src/MenuForm.php | 4 ++-- core/modules/menu_ui/src/Tests/MenuTest.php | 2 +- 18 files changed, 37 insertions(+), 37 deletions(-) diff --git a/core/modules/action/action.module b/core/modules/action/action.module index 8e11de1a5f6f..5e0412eac1ac 100644 --- a/core/modules/action/action.module +++ b/core/modules/action/action.module @@ -29,7 +29,7 @@ function action_help($route_name, RouteMatchInterface $route_match) { $output = '

' . t('There are two types of actions: simple and advanced. Simple actions do not require any additional configuration and are listed here automatically. Advanced actions need to be created and configured before they can be used because they have options that need to be specified; for example, sending an email to a specified address or unpublishing content containing certain words. To create an advanced action, select the action from the drop-down list in the advanced action section below and click the Create button.') . '

'; return $output; - case 'action.admin_configure': + case 'entity.action.edit_form': return t('An advanced action offers additional configuration options which may be filled out below. Changing the Description field is recommended in order to better identify the precise action taking place.'); } } @@ -55,6 +55,6 @@ function action_entity_type_build(array &$entity_types) { ->setFormClass('edit', 'Drupal\action\ActionEditForm') ->setFormClass('delete', 'Drupal\action\Form\ActionDeleteForm') ->setListBuilderClass('Drupal\action\ActionListBuilder') - ->setLinkTemplate('delete-form', 'action.delete') - ->setLinkTemplate('edit-form', 'action.admin_configure'); + ->setLinkTemplate('delete-form', 'entity.action.delete_form') + ->setLinkTemplate('edit-form', 'entity.action.edit_form'); } diff --git a/core/modules/action/action.routing.yml b/core/modules/action/action.routing.yml index 535830a49fd7..c75ff23e31d6 100644 --- a/core/modules/action/action.routing.yml +++ b/core/modules/action/action.routing.yml @@ -14,7 +14,7 @@ action.admin_add: requirements: _permission: 'administer actions' -action.admin_configure: +entity.action.edit_form: path: '/admin/config/system/actions/configure/{action}' defaults: _entity_form: 'action.edit' @@ -22,7 +22,7 @@ action.admin_configure: requirements: _permission: 'administer actions' -action.delete: +entity.action.delete_form: path: '/admin/config/system/actions/configure/{action}/delete' defaults: _entity_form: 'action.delete' diff --git a/core/modules/contact/contact.links.task.yml b/core/modules/contact/contact.links.task.yml index becce68790e0..2c38ae21e26f 100644 --- a/core/modules/contact/contact.links.task.yml +++ b/core/modules/contact/contact.links.task.yml @@ -3,8 +3,8 @@ entity.contact_form.edit_form: route_name: entity.contact_form.edit_form base_route: entity.contact_form.edit_form -contact.personal_page: +entity.user.contact_form: title: 'Contact' - route_name: contact.personal_page + route_name: entity.user.contact_form weight: 2 base_route: entity.user.canonical diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index afbbc8d62eae..ac073eb2b86b 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -60,7 +60,7 @@ function contact_permission() { */ function contact_entity_type_alter(array &$entity_types) { /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */ - $entity_types['user']->setLinkTemplate('contact-form', 'contact.personal_page'); + $entity_types['user']->setLinkTemplate('contact-form', 'entity.user.contact_form'); } /** diff --git a/core/modules/contact/contact.routing.yml b/core/modules/contact/contact.routing.yml index 567ccf0e90d1..7eb073910a47 100644 --- a/core/modules/contact/contact.routing.yml +++ b/core/modules/contact/contact.routing.yml @@ -47,7 +47,7 @@ contact.site_page_form: requirements: _entity_access: 'contact_form.view' -contact.personal_page: +entity.user.contact_form: path: '/user/{user}/contact' defaults: _title: 'Contact' diff --git a/core/modules/contact/src/Plugin/views/field/ContactLink.php b/core/modules/contact/src/Plugin/views/field/ContactLink.php index 8b0ce91862a0..50c3191eec27 100644 --- a/core/modules/contact/src/Plugin/views/field/ContactLink.php +++ b/core/modules/contact/src/Plugin/views/field/ContactLink.php @@ -112,7 +112,7 @@ class ContactLink extends Link { // Check access when we pull up the user account so we know // if the user has made the contact page available. - if (!$this->accessManager->checkNamedRoute('contact.personal_page', array('user' => $entity->id()), $this->currentUser())) { + if (!$this->accessManager->checkNamedRoute('entity.user.contact_form', array('user' => $entity->id()), $this->currentUser())) { return; } diff --git a/core/modules/menu_link_content/menu_link_content.routing.yml b/core/modules/menu_link_content/menu_link_content.routing.yml index 4890e97684e4..20832e944973 100644 --- a/core/modules/menu_link_content/menu_link_content.routing.yml +++ b/core/modules/menu_link_content/menu_link_content.routing.yml @@ -1,4 +1,4 @@ -menu_link_content.link_add: +entity.menu.add_link_form: path: '/admin/structure/menu/manage/{menu}/add' defaults: _content: '\Drupal\menu_link_content\Controller\MenuController::addLink' diff --git a/core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php b/core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php index c5a7232882ea..59ffa21ab8f8 100644 --- a/core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php +++ b/core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php @@ -60,7 +60,7 @@ class MenuLinkContentDeleteForm extends ContentEntityConfirmFormBase { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('menu_ui.menu_edit', array('menu' => $this->entity->getMenuName())); + return new Url('entity.menu.edit_form', array('menu' => $this->entity->getMenuName())); } /** diff --git a/core/modules/menu_ui/menu_ui.links.action.yml b/core/modules/menu_ui/menu_ui.links.action.yml index af8716f96b53..848bcbefdd7e 100644 --- a/core/modules/menu_ui/menu_ui.links.action.yml +++ b/core/modules/menu_ui/menu_ui.links.action.yml @@ -1,12 +1,12 @@ -menu_ui.link_add: - route_name: menu_link_content.link_add +entity.menu.add_link_form: + route_name: entity.menu.add_link_form title: 'Add link' class: \Drupal\menu_ui\Plugin\Menu\LocalAction\MenuLinkAdd appears_on: - - menu_ui.menu_edit + - entity.menu.edit_form -menu_ui.menu_add: - route_name: menu_ui.menu_add +entity.menu.add_form: + route_name: entity.menu.add_form title: 'Add menu' appears_on: - menu_ui.overview_page diff --git a/core/modules/menu_ui/menu_ui.links.contextual.yml b/core/modules/menu_ui/menu_ui.links.contextual.yml index 22e3a4e6feb8..9a2241f1110d 100644 --- a/core/modules/menu_ui/menu_ui.links.contextual.yml +++ b/core/modules/menu_ui/menu_ui.links.contextual.yml @@ -1,4 +1,4 @@ -menu_ui_edit: +entity.menu.edit_form: title: 'Edit menu' - route_name: 'menu_ui.menu_edit' + route_name: 'entity.menu.edit_form' group: menu diff --git a/core/modules/menu_ui/menu_ui.links.task.yml b/core/modules/menu_ui/menu_ui.links.task.yml index 92aadeb0b671..d9f193793604 100644 --- a/core/modules/menu_ui/menu_ui.links.task.yml +++ b/core/modules/menu_ui/menu_ui.links.task.yml @@ -1,7 +1,7 @@ -menu_ui.menu_edit: +entity.menu.edit_form: title: 'Edit menu' - route_name: menu_ui.menu_edit - base_route: menu_ui.menu_edit + route_name: entity.menu.edit_form + base_route: entity.menu.edit_form menu_ui.overview_page: title: 'List' diff --git a/core/modules/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module index 820887ae3e41..f2591ddb053d 100644 --- a/core/modules/menu_ui/menu_ui.module +++ b/core/modules/menu_ui/menu_ui.module @@ -45,7 +45,7 @@ function menu_ui_help($route_name, RouteMatchInterface $route_match) { $output .= ''; return $output; } - if ($route_name == 'menu_ui.menu_add' && \Drupal::moduleHandler()->moduleExists('block')) { + if ($route_name == 'entity.menu.add_form' && \Drupal::moduleHandler()->moduleExists('block')) { return '

' . t('You can enable the newly-created block for this menu on the Block layout page.', array('!blocks' => \Drupal::url('block.admin_display'))) . '

'; } elseif ($route_name == 'menu_ui.overview_page' && \Drupal::moduleHandler()->moduleExists('block')) { @@ -74,10 +74,10 @@ function menu_ui_entity_type_build(array &$entity_types) { ->setFormClass('edit', 'Drupal\menu_ui\MenuForm') ->setFormClass('delete', 'Drupal\menu_ui\Form\MenuDeleteForm') ->setListBuilderClass('Drupal\menu_ui\MenuListBuilder') - ->setLinkTemplate('add-form', 'menu_ui.menu_add') - ->setLinkTemplate('delete-form', 'menu_ui.delete_menu') - ->setLinkTemplate('edit-form', 'menu_ui.menu_edit') - ->setLinkTemplate('add-link-form', 'menu_link_content.link_add'); + ->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'); } @@ -567,7 +567,7 @@ function menu_ui_system_breadcrumb_alter(array &$breadcrumb, RouteMatchInterface if (($menu_link instanceof MenuLinkInterface)) { // Add a link to the menu admin screen. $menu = Menu::load($menu_link->getMenuName()); - $breadcrumb[] = Link::createFromRoute($menu->label(), 'menu_ui.menu_edit', array('menu' => $menu->id())); + $breadcrumb[] = Link::createFromRoute($menu->label(), 'entity.menu.edit_form', array('menu' => $menu->id())); } } } diff --git a/core/modules/menu_ui/menu_ui.routing.yml b/core/modules/menu_ui/menu_ui.routing.yml index b095c344beaf..1b431e948a67 100644 --- a/core/modules/menu_ui/menu_ui.routing.yml +++ b/core/modules/menu_ui/menu_ui.routing.yml @@ -46,7 +46,7 @@ menu_ui.link_reset: _permission: 'administer menu' _custom_access: '\Drupal\menu_ui\Form\MenuLinkResetForm::linkIsResettable' -menu_ui.menu_add: +entity.menu.add_form: path: '/admin/structure/menu/add' defaults: _entity_form: 'menu.add' @@ -54,7 +54,7 @@ menu_ui.menu_add: requirements: _entity_create_access: 'menu' -menu_ui.menu_edit: +entity.menu.edit_form: path: '/admin/structure/menu/manage/{menu}' defaults: _entity_form: 'menu.edit' @@ -62,7 +62,7 @@ menu_ui.menu_edit: requirements: _entity_access: 'menu.update' -menu_ui.delete_menu: +entity.menu.delete_form: path: '/admin/structure/menu/manage/{menu}/delete' defaults: _entity_form: 'menu.delete' diff --git a/core/modules/menu_ui/src/Form/MenuDeleteForm.php b/core/modules/menu_ui/src/Form/MenuDeleteForm.php index 299df369fa00..764a7c5689a6 100644 --- a/core/modules/menu_ui/src/Form/MenuDeleteForm.php +++ b/core/modules/menu_ui/src/Form/MenuDeleteForm.php @@ -106,7 +106,7 @@ class MenuDeleteForm extends EntityConfirmFormBase { // parameter that is being removed. Also, consider moving this to // menu_ui.module as part of a generic response to entity deletion. // https://www.drupal.org/node/2310329 - $menu_links = $this->menuLinkManager->loadLinksByRoute('menu_ui.menu_edit', array('menu' => $this->entity->id()), TRUE); + $menu_links = $this->menuLinkManager->loadLinksByRoute('entity.menu.edit_form', array('menu' => $this->entity->id()), TRUE); foreach ($menu_links as $id => $link) { $this->menuLinkManager->removeDefinition($id); } diff --git a/core/modules/menu_ui/src/Form/MenuLinkEditForm.php b/core/modules/menu_ui/src/Form/MenuLinkEditForm.php index 784024a0315c..fae404ce83ad 100644 --- a/core/modules/menu_ui/src/Form/MenuLinkEditForm.php +++ b/core/modules/menu_ui/src/Form/MenuLinkEditForm.php @@ -96,7 +96,7 @@ class MenuLinkEditForm extends FormBase { drupal_set_message($this->t('The menu link has been saved.')); $form_state->setRedirect( - 'menu_ui.menu_edit', + 'entity.menu.edit_form', array('menu' => $link->getMenuName()) ); } diff --git a/core/modules/menu_ui/src/Form/MenuLinkResetForm.php b/core/modules/menu_ui/src/Form/MenuLinkResetForm.php index d0bd61e172d0..74d0fa0b378b 100644 --- a/core/modules/menu_ui/src/Form/MenuLinkResetForm.php +++ b/core/modules/menu_ui/src/Form/MenuLinkResetForm.php @@ -71,7 +71,7 @@ class MenuLinkResetForm extends ConfirmFormBase { * {@inheritdoc} */ public function getCancelUrl() { - return new Url('menu_ui.menu_edit', array( + return new Url('entity.menu.edit_form', array( 'menu' => $this->link->getMenuName(), )); } diff --git a/core/modules/menu_ui/src/MenuForm.php b/core/modules/menu_ui/src/MenuForm.php index 58cb663f7655..fde70bb06514 100644 --- a/core/modules/menu_ui/src/MenuForm.php +++ b/core/modules/menu_ui/src/MenuForm.php @@ -239,8 +239,8 @@ class MenuForm extends EntityForm { $delta = max($count($tree), 50); $form = array_merge($form, $this->buildOverviewTreeForm($tree, $delta)); - $destination = $this->getUrlGenerator()->getPathFromRoute('menu_ui.menu_edit', array('menu' => $this->entity->id())); - $url = $destination = $this->url('menu_link_content.link_add', array('menu' => $this->entity->id()), array('query' => array('destination' => $destination))); + $destination = $this->getUrlGenerator()->getPathFromRoute('entity.menu.edit_form', array('menu' => $this->entity->id())); + $url = $destination = $this->url('entity.menu.add_link_form', array('menu' => $this->entity->id()), array('query' => array('destination' => $destination))); $form['#empty_text'] = $this->t('There are no menu links yet. Add link.', array('@url' => $url)); return $form; diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php index 54bfd000e00a..09bc6f45fc3e 100644 --- a/core/modules/menu_ui/src/Tests/MenuTest.php +++ b/core/modules/menu_ui/src/Tests/MenuTest.php @@ -530,7 +530,7 @@ class MenuTest extends MenuWebTestBase { $response = $this->drupalPost('contextual/render', 'application/json', $post, array('query' => array('destination' => 'test-page'))); $this->assertResponse(200); $json = Json::decode($response); - $this->assertIdentical($json[$id], ''); + $this->assertIdentical($json[$id], ''); } /**