Issue #2285413 by andypost: [Meta] Standardize entity route names.
parent
05212a9727
commit
ebace9e86b
|
|
@ -29,7 +29,7 @@ function action_help($route_name, RouteMatchInterface $route_match) {
|
|||
$output = '<p>' . 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 <em>Create</em> button.') . '</p>';
|
||||
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 <em>Description</em> 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');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ function menu_ui_help($route_name, RouteMatchInterface $route_match) {
|
|||
$output .= '</dl>';
|
||||
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 '<p>' . t('You can enable the newly-created block for this menu on the <a href="!blocks">Block layout page</a>.', array('!blocks' => \Drupal::url('block.admin_display'))) . '</p>';
|
||||
}
|
||||
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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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. <a href="@url">Add link</a>.', array('@url' => $url));
|
||||
|
||||
return $form;
|
||||
|
|
|
|||
|
|
@ -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], '<ul class="contextual-links"><li class="block-configure"><a href="' . base_path() . 'admin/structure/block/manage/' . $block->id() . '">Configure block</a></li><li class="menu-ui-edit"><a href="' . base_path() . 'admin/structure/menu/manage/tools">Edit menu</a></li></ul>');
|
||||
$this->assertIdentical($json[$id], '<ul class="contextual-links"><li class="block-configure"><a href="' . base_path() . 'admin/structure/block/manage/' . $block->id() . '">Configure block</a></li><li class="entitymenuedit-form"><a href="' . base_path() . 'admin/structure/menu/manage/tools">Edit menu</a></li></ul>');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue