diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index c76dc40..24a0ebf 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -164,8 +164,9 @@ public function urlInfo($rel = 'canonical', array $options = []) { $link_templates = $this->linkTemplates(); if (isset($link_templates[$rel])) { - // If there is a template for the given relationship type, generate the path. - $uri = new Url($link_templates[$rel], $this->urlRouteParameters($rel)); + $route_parameters = $this->urlRouteParameters($rel); + $route_name = "entity.{$this->entityTypeId}." . str_replace(array('-', 'drupal:'), array('_', ''), $rel); + $uri = new Url($route_name, $route_parameters); } else { $bundle = $this->bundle(); @@ -224,7 +225,7 @@ public function hasLinkTemplate($rel) { * Returns an array link templates. * * @return array - * An array of link templates containing route names. + * An array of link templates containing paths. */ protected function linkTemplates() { return $this->getEntityType()->getLinkTemplates(); diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php index d8e8e3e..fb1d932 100644 --- a/core/lib/Drupal/Core/Entity/EntityInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -105,9 +105,9 @@ public function label(); * example: * @code * links = { - * "canonical" = "entity.node.canonical", - * "edit-form" = "entity.node.edit_form", - * "version-history" = "entity.node.version_history" + * "canonical" = "/node/{node}", + * "edit-form" = "/node/{node}/edit", + * "version-history" = "/node/{node}/revisions" * } * @endcode * or specified in a callback function set like: diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php index 9c99d0a..b23cd9d 100644 --- a/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -546,8 +546,12 @@ public function hasLinkTemplate($key) { /** * {@inheritdoc} */ - public function setLinkTemplate($key, $route_name) { - $this->links[$key] = $route_name; + public function setLinkTemplate($key, $path) { + if ($path[0] !== '/') { + throw new \InvalidArgumentException('Link templates accepts paths, which have to start with a leading slash.'); + } + + $this->links[$key] = $path; return $this; } diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php index 7a87db9..8104828 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -455,7 +455,7 @@ public function getLinkTemplates(); * The link type. * * @return string|bool - * The route name for this link, or FALSE if it doesn't exist. + * The path for this link, or FALSE if it doesn't exist. */ public function getLinkTemplate($key); @@ -475,12 +475,12 @@ public function hasLinkTemplate($key); * * @param string $key * The name of a link. - * @param string $route_name - * The route name to use for the link. + * @param string $path + * The route path to use for the link. * * @return $this */ - public function setLinkTemplate($key, $route_name); + public function setLinkTemplate($key, $path); /** * Gets the callback for the label of the entity. diff --git a/core/modules/action/action.module b/core/modules/action/action.module index f1cde81..22138ae 100644 --- a/core/modules/action/action.module +++ b/core/modules/action/action.module @@ -44,6 +44,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', 'entity.action.delete_form') - ->setLinkTemplate('edit-form', 'entity.action.edit_form'); + ->setLinkTemplate('delete-form', '/admin/config/system/actions/configure/{action}/delete') + ->setLinkTemplate('edit-form', '/admin/config/system/actions/configure/{action}'); } diff --git a/core/modules/aggregator/src/Entity/Feed.php b/core/modules/aggregator/src/Entity/Feed.php index fe468b6..7f0c287 100644 --- a/core/modules/aggregator/src/Entity/Feed.php +++ b/core/modules/aggregator/src/Entity/Feed.php @@ -33,9 +33,9 @@ * } * }, * links = { - * "canonical" = "entity.aggregator_feed.canonical", - * "edit-form" = "entity.aggregator_feed.edit_form", - * "delete-form" = "entity.aggregator_feed.delete_form", + * "canonical" = "/aggregator/sources/{aggregator_feed}", + * "edit-form" = "/aggregator/sources/{aggregator_feed}/configure", + * "delete-form" = "/aggregator/sources/{aggregator_feed}/delete", * }, * field_ui_base_route = "aggregator.admin_overview", * base_table = "aggregator_feed", diff --git a/core/modules/block/src/Entity/Block.php b/core/modules/block/src/Entity/Block.php index 0edc961..275acde 100644 --- a/core/modules/block/src/Entity/Block.php +++ b/core/modules/block/src/Entity/Block.php @@ -36,8 +36,8 @@ * "id" = "id" * }, * links = { - * "delete-form" = "entity.block.delete_form", - * "edit-form" = "entity.block.edit_form" + * "delete-form" = "/admin/structure/block/manage/{block}/delete", + * "edit-form" = "/admin/structure/block/manage/{block}" * } * ) */ diff --git a/core/modules/block_content/block_content.routing.yml b/core/modules/block_content/block_content.routing.yml index 90d26ea..6ab7937 100644 --- a/core/modules/block_content/block_content.routing.yml +++ b/core/modules/block_content/block_content.routing.yml @@ -45,6 +45,15 @@ entity.block_content.canonical: requirements: _entity_access: 'block_content.update' +entity.block_content.edit_form: + path: '/block/{block_content}' + defaults: + _entity_form: 'block_content.edit' + options: + _admin_route: TRUE + requirements: + _entity_access: 'block_content.update' + entity.block_content.delete_form: path: '/block/{block_content}/delete' defaults: diff --git a/core/modules/block_content/src/Entity/BlockContent.php b/core/modules/block_content/src/Entity/BlockContent.php index 4908d95..f3c4767 100644 --- a/core/modules/block_content/src/Entity/BlockContent.php +++ b/core/modules/block_content/src/Entity/BlockContent.php @@ -39,9 +39,9 @@ * revision_table = "block_content_revision", * data_table = "block_content_field_data", * links = { - * "canonical" = "entity.block_content.canonical", - * "delete-form" = "entity.block_content.delete_form", - * "edit-form" = "entity.block_content.canonical", + * "canonical" = "/block/{block_content}", + * "delete-form" = "/block/{block_content}/delete", + * "edit-form" = "/block/{block_content}", * }, * 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..d4308e7 100644 --- a/core/modules/block_content/src/Entity/BlockContentType.php +++ b/core/modules/block_content/src/Entity/BlockContentType.php @@ -35,8 +35,8 @@ * "label" = "label" * }, * links = { - * "delete-form" = "entity.block_content_type.delete_form", - * "edit-form" = "entity.block_content_type.edit_form" + * "delete-form" = "/admin/structure/block/block-content/manage/{block_content_type}/delete", + * "edit-form" = "/admin/structure/block/block-content/manage/{block_content_type}" * } * ) */ diff --git a/core/modules/book/book.module b/core/modules/book/book.module index 51da823..9c7ab55 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -89,8 +89,8 @@ function book_entity_type_build(array &$entity_types) { /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */ $entity_types['node'] ->setFormClass('book_outline', 'Drupal\book\Form\BookOutlineForm') - ->setLinkTemplate('book-outline-form', 'entity.node.book_outline_form') - ->setLinkTemplate('book-remove-form', 'entity.node.book_remove_form'); + ->setLinkTemplate('book-outline-form', '/node/{node}/outline') + ->setLinkTemplate('book-remove-form', '/node/{node}/outline/remove'); } /** diff --git a/core/modules/comment/src/Entity/Comment.php b/core/modules/comment/src/Entity/Comment.php index 828c1b6..8b24aba 100644 --- a/core/modules/comment/src/Entity/Comment.php +++ b/core/modules/comment/src/Entity/Comment.php @@ -47,9 +47,9 @@ * "uuid" = "uuid" * }, * links = { - * "canonical" = "entity.comment.canonical", - * "delete-form" = "entity.comment.delete_form", - * "edit-form" = "entity.comment.edit_form", + * "canonical" = "/comment/{comment}", + * "delete-form" = "/comment/{comment}/delete", + * "edit-form" = "/comment/{comment}/edit", * }, * bundle_entity_type = "comment_type", * field_ui_base_route = "entity.comment_type.edit_form", diff --git a/core/modules/comment/src/Entity/CommentType.php b/core/modules/comment/src/Entity/CommentType.php index 8c36b22..80a1aaa 100644 --- a/core/modules/comment/src/Entity/CommentType.php +++ b/core/modules/comment/src/Entity/CommentType.php @@ -34,9 +34,9 @@ * "label" = "label" * }, * links = { - * "delete-form" = "entity.comment_type.delete_form", - * "edit-form" = "entity.comment_type.edit_form", - * "add-form" = "entity.comment_type.add_form" + * "delete-form" = "/admin/structure/comment/manage/{comment_type}/delete", + * "edit-form" = "/admin/structure/comment/manage/{comment_type}", + * "add-form" = "/admin/structure/comment/types/add" * } * ) */ diff --git a/core/modules/comment/src/Form/CommentAdminOverview.php b/core/modules/comment/src/Form/CommentAdminOverview.php index 4abff68..c241841 100644 --- a/core/modules/comment/src/Form/CommentAdminOverview.php +++ b/core/modules/comment/src/Form/CommentAdminOverview.php @@ -224,7 +224,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $type = ' if ($this->moduleHandler->moduleExists('content_translation') && $this->moduleHandler->invoke('content_translation', 'translate_access', array($comment))->isAllowed()) { $links['translate'] = array( 'title' => $this->t('Translate'), - 'url' => Url::fromRoute('content_translation.translation_overview_comment', ['comment' => $comment->id()], $comment_uri_options + ['query' => $destination]), + 'url' => Url::fromRoute('entity.comment.content_translation_overview', ['comment' => $comment->id()], $comment_uri_options + ['query' => $destination]), ); } $options[$comment->id()]['operations']['data'] = array( diff --git a/core/modules/comment/src/Tests/CommentTypeTest.php b/core/modules/comment/src/Tests/CommentTypeTest.php index 148d1ef..060d69d 100644 --- a/core/modules/comment/src/Tests/CommentTypeTest.php +++ b/core/modules/comment/src/Tests/CommentTypeTest.php @@ -108,7 +108,7 @@ public function testCommentTypeEditing() { $this->drupalGet('admin/structure/comment'); $this->assertRaw('Bar', 'New name was displayed.'); $this->clickLink('Manage fields'); - $this->assertUrl(\Drupal::url('field_ui.overview_comment', array('comment_type' => 'comment'), array('absolute' => TRUE)), [], 'Original machine name was used in URL.'); + $this->assertUrl(\Drupal::url('entity.comment_type.field_ui_fields', ['comment_type' => 'comment'], ['absolute' => TRUE]), [], 'Original machine name was used in URL.'); $this->assertTrue($this->cssSelect('tr#comment-body'), 'Body field exists.'); // Remove the body field. diff --git a/core/modules/config/tests/config_test/config_test.module b/core/modules/config/tests/config_test/config_test.module index 1f3a30b..d7742d0 100644 --- a/core/modules/config/tests/config_test/config_test.module +++ b/core/modules/config/tests/config_test/config_test.module @@ -50,8 +50,8 @@ function config_test_entity_type_alter(array &$entity_types) { // Create a clone of config_test that does not have a status. $entity_types['config_test_no_status'] = clone $entity_types['config_test']; $config_test_no_status = &$entity_types['config_test_no_status']; - $config_test_no_status->setLinkTemplate('edit-form', 'entity.config_test.edit_form_config_test_no_status'); - $config_test_no_status->setLinkTemplate('delete-form', 'entity.config_test.delete_form_config_test_no_status'); + $config_test_no_status->setLinkTemplate('edit-form', '/admin/structure/config_test/manage/{config_test_no_status}'); + $config_test_no_status->setLinkTemplate('delete-form', '/admin/structure/config_test/manage/{config_test_no_status}/delete'); $keys = $config_test_no_status->getKeys(); unset($keys['status']); 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..d9b69df 100644 --- a/core/modules/config/tests/config_test/src/Entity/ConfigTest.php +++ b/core/modules/config/tests/config_test/src/Entity/ConfigTest.php @@ -34,10 +34,10 @@ * "status" = "status" * }, * links = { - * "edit-form" = "entity.config_test.edit_form", - * "delete-form" = "entity.config_test.delete_form", - * "enable" = "entity.config_test.enable", - * "disable" = "entity.config_test.disable" + * "edit-form" = "/admin/structure/config_test/manage/{config_test}", + * "delete-form" = "/admin/structure/config_test/manage/{config_test}/delete", + * "enable" = "/admin/structure/config_test/manage/{config_test}/enable", + * "disable" = "/admin/structure/config_test/manage/{config_test}/disable" * } * ) */ diff --git a/core/modules/config_translation/config_translation.api.php b/core/modules/config_translation/config_translation.api.php index e44c168..f631655 100644 --- a/core/modules/config_translation/config_translation.api.php +++ b/core/modules/config_translation/config_translation.api.php @@ -36,13 +36,13 @@ function hook_config_translation_info(&$info) { $route_provider = \Drupal::service('router.route_provider'); // If field UI is not enabled, the base routes of the type - // "field_ui.field_edit_$entity_type" are not defined. + // "entity.field_config.{$entity_type}_field_edit_form" are not defined. if (\Drupal::moduleHandler()->moduleExists('field_ui')) { // Add fields entity mappers to all fieldable entity types defined. foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) { $base_route = NULL; try { - $base_route = $route_provider->getRouteByName('field_ui.field_edit_' . $entity_type_id); + $base_route = $route_provider->getRouteByName('entity.field_config.' . $entity_type_id . '_field_edit_form'); } catch (RouteNotFoundException $e) { // Ignore non-existent routes. @@ -51,7 +51,7 @@ function hook_config_translation_info(&$info) { // Make sure entity type has field UI enabled and has a base route. if ($entity_type->get('field_ui_base_route') && !empty($base_route)) { $info[$entity_type_id . '_fields'] = array( - 'base_route_name' => 'field_ui.field_edit_' . $entity_type_id, + 'base_route_name' => 'entity.field_config.' . $entity_type_id . '_field_edit_form', 'entity_type' => 'field_config', 'title' => t('!label field'), 'class' => '\Drupal\config_translation\ConfigFieldMapper', diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module index 336a405..3655d49 100644 --- a/core/modules/config_translation/config_translation.module +++ b/core/modules/config_translation/config_translation.module @@ -8,6 +8,7 @@ use Drupal\config_translation\Plugin\Derivative\ConfigTranslationLocalTasks; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\field\FieldConfigInterface; use Symfony\Component\Routing\Exception\RouteNotFoundException; /** @@ -83,7 +84,7 @@ function config_translation_entity_type_alter(array &$entity_types) { elseif ($entity_type_id == 'field_config') { $class = 'Drupal\config_translation\Controller\ConfigTranslationFieldListBuilder'; // Will be filled in dynamically, see \Drupal\field\Entity\FieldConfig::linkTemplates(). - $entity_type->setLinkTemplate('drupal:config-translation-overview', 'config_translation.item.overview.'); + $entity_type->setLinkTemplate('config-translation-overview', $entity_type->getLinkTemplate('edit-form') . '/translate'); } else { $class = 'Drupal\config_translation\Controller\ConfigTranslationEntityListBuilder'; @@ -91,7 +92,7 @@ function config_translation_entity_type_alter(array &$entity_types) { $entity_type->setHandlerClass('config_translation_list', $class); if ($entity_type->hasLinkTemplate('edit-form')) { - $entity_type->setLinkTemplate('drupal:config-translation-overview', 'config_translation.item.overview.' . $entity_type->getLinkTemplate('edit-form')); + $entity_type->setLinkTemplate('config-translation-overview', $entity_type->getLinkTemplate('edit-form') . '/translate'); } } } @@ -105,14 +106,14 @@ function config_translation_config_translation_info(&$info) { $route_provider = \Drupal::service('router.route_provider'); // If field UI is not enabled, the base routes of the type - // "field_ui.field_edit_$entity_type" are not defined. + // "entity.field_config.{$entity_type}_field_edit_form" are not defined. if (\Drupal::moduleHandler()->moduleExists('field_ui')) { // Add fields entity mappers to all fieldable entity types defined. foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) { // Make sure entity type has field UI enabled and has a base route. if ($entity_type->get('field_ui_base_route')) { $info[$entity_type_id . '_fields'] = array( - 'base_route_name' => 'field_ui.field_edit_' . $entity_type_id, + 'base_route_name' => "entity.field_config.{$entity_type_id}_field_edit_form", 'entity_type' => 'field_config', 'title' => '!label field', 'class' => '\Drupal\config_translation\ConfigFieldMapper', @@ -139,9 +140,10 @@ function config_translation_config_translation_info(&$info) { } // Use the entity type as the plugin ID. + $base_route_name = "entity.$entity_type_id.edit_form"; $info[$entity_type_id] = array( 'class' => '\Drupal\config_translation\ConfigEntityMapper', - 'base_route_name' => $entity_type->getLinkTemplate('edit-form'), + 'base_route_name' => $base_route_name, 'title' => '!label !entity_type', 'names' => array(), 'entity_type' => $entity_type_id, @@ -157,12 +159,18 @@ function config_translation_entity_operation(EntityInterface $entity) { $operations = array(); $entity_type = $entity->getEntityType(); if ($entity_type->isSubclassOf('Drupal\Core\Config\Entity\ConfigEntityInterface') && - $entity->hasLinkTemplate('drupal:config-translation-overview') && + $entity->hasLinkTemplate('config-translation-overview') && \Drupal::currentUser()->hasPermission('translate configuration')) { + + $link_template = 'config-translation-overview'; + if ($entity instanceof FieldConfigInterface) { + $link_template = "config-translation-overview.{$entity->getTargetEntityTypeId()}"; + } + $operations['translate'] = array( 'title' => t('Translate'), 'weight' => 50, - 'url' => $entity->urlInfo('drupal:config-translation-overview'), + 'url' => $entity->urlInfo($link_template), ); } diff --git a/core/modules/config_translation/src/ConfigEntityMapper.php b/core/modules/config_translation/src/ConfigEntityMapper.php index 848a6ce..e9bdc60 100644 --- a/core/modules/config_translation/src/ConfigEntityMapper.php +++ b/core/modules/config_translation/src/ConfigEntityMapper.php @@ -245,6 +245,13 @@ public function getContextualLinkGroup() { /** * {@inheritdoc} */ + public function getOverviewRouteName() { + return 'entity.' . $this->entityType . '.config_translation_overview'; + } + + /** + * {@inheritdoc} + */ protected function processRoute(Route $route) { // Add entity upcasting information. $parameters = $route->getOption('parameters') ?: array(); diff --git a/core/modules/config_translation/src/ConfigFieldMapper.php b/core/modules/config_translation/src/ConfigFieldMapper.php index 242e084..e9d48e4 100644 --- a/core/modules/config_translation/src/ConfigFieldMapper.php +++ b/core/modules/config_translation/src/ConfigFieldMapper.php @@ -37,6 +37,13 @@ public function getBaseRouteParameters() { /** * {@inheritdoc} */ + public function getOverviewRouteName() { + return 'entity.field_config.config_translation_overview.' . $this->pluginDefinition['base_entity_type']; + } + + /** + * {@inheritdoc} + */ public function getTypeLabel() { $base_entity_info = $this->entityManager->getDefinition($this->pluginDefinition['base_entity_type']); return $this->t('@label fields', array('@label' => $base_entity_info->getLabel())); diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index 99ac31f..c56633f 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -43,7 +43,7 @@ function contact_help($route_name, RouteMatchInterface $route_match) { */ function contact_entity_type_alter(array &$entity_types) { /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */ - $entity_types['user']->setLinkTemplate('contact-form', 'entity.user.contact_form'); + $entity_types['user']->setLinkTemplate('contact-form', '/user/{user}/contact'); } /** diff --git a/core/modules/contact/src/Entity/ContactForm.php b/core/modules/contact/src/Entity/ContactForm.php index 2dd7ce3..c6ffdaf 100644 --- a/core/modules/contact/src/Entity/ContactForm.php +++ b/core/modules/contact/src/Entity/ContactForm.php @@ -34,8 +34,8 @@ * "label" = "label" * }, * links = { - * "delete-form" = "entity.contact_form.delete_form", - * "edit-form" = "entity.contact_form.edit_form" + * "delete-form" = "/admin/structure/contact/manage/{contact_form}/delete", + * "edit-form" = "/admin/structure/contact/manage/{contact_form}" * } * ) */ diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index 89a6cbb..9f5ae57 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -116,7 +116,7 @@ function content_translation_entity_type_alter(array &$entity_types) { if ($entity_type->hasLinkTemplate('canonical')) { // Provide default route names for the translation paths. if (!$entity_type->hasLinkTemplate('drupal:content-translation-overview')) { - $entity_type->setLinkTemplate('drupal:content-translation-overview', "content_translation.translation_overview_" . $entity_type->id()); + $entity_type->setLinkTemplate('drupal:content-translation-overview', $entity_type->getLinkTemplate('canonical') . '/translations'); } // @todo Remove this as soon as menu access checks rely on the // controller. See https://drupal.org/node/2155787. diff --git a/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php b/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php index b1f424f..9acf394 100644 --- a/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php +++ b/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php @@ -53,7 +53,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { // Create contextual links for translatable entity types. foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type_id => $entity_type) { $this->derivatives[$entity_type_id]['title'] = t('Translate'); - $this->derivatives[$entity_type_id]['route_name'] = $entity_type->getLinkTemplate('drupal:content-translation-overview'); + $this->derivatives[$entity_type_id]['route_name'] = "entity.$entity_type_id.content_translation_overview"; $this->derivatives[$entity_type_id]['group'] = $entity_type_id; } return parent::getDerivativeDefinitions($base_plugin_definition); diff --git a/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php b/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php index 8b060f2..995de59 100644 --- a/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php +++ b/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php @@ -61,13 +61,14 @@ public function getDerivativeDefinitions($base_plugin_definition) { // Create tabs for all possible entity types. foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type_id => $entity_type) { // Find the route name for the translation overview. - $translation_route_name = $entity_type->getLinkTemplate('drupal:content-translation-overview'); + $translation_route_name = "entity.$entity_type_id.content_translation_overview"; + $base_route_name = "entity.$entity_type_id.canonical"; $this->derivatives[$translation_route_name] = array( 'entity_type' => $entity_type_id, 'title' => 'Translate', 'route_name' => $translation_route_name, - 'base_route' => $entity_type->getLinkTemplate('canonical'), + 'base_route' => $base_route_name, ) + $base_plugin_definition; } return parent::getDerivativeDefinitions($base_plugin_definition); diff --git a/core/modules/content_translation/src/Routing/ContentTranslationRouteSubscriber.php b/core/modules/content_translation/src/Routing/ContentTranslationRouteSubscriber.php index 2ec582b..f6c5bc0 100644 --- a/core/modules/content_translation/src/Routing/ContentTranslationRouteSubscriber.php +++ b/core/modules/content_translation/src/Routing/ContentTranslationRouteSubscriber.php @@ -42,17 +42,26 @@ public function __construct(ContentTranslationManagerInterface $content_translat protected function alterRoutes(RouteCollection $collection) { foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type_id => $entity_type) { // Try to get the route from the current collection. - if (!$entity_route = $collection->get($entity_type->getLinkTemplate('canonical'))) { - continue; + $link_template = $entity_type->getLinkTemplate('canonical'); + if (strpos($link_template, '/') !== FALSE) { + $base_path = '/' . $link_template; + } + else { + if (!$entity_route = $collection->get("entity.$entity_type_id.canonical")) { + continue; + } + $base_path = $entity_route->getPath(); } - $path = $entity_route->getPath() . '/translations'; // Inherit admin route status from edit route, if exists. $is_admin = FALSE; - if ($edit_route = $collection->get($entity_type->getLinkTemplate('edit-form'))) { + $route_name = "entity.$entity_type_id.edit_form"; + if ($edit_route = $collection->get($route_name)) { $is_admin = (bool) $edit_route->getOption('_admin_route'); } + $path = $base_path . '/translations'; + $route = new Route( $path, array( @@ -71,7 +80,8 @@ protected function alterRoutes(RouteCollection $collection) { '_admin_route' => $is_admin, ) ); - $collection->add($entity_type->getLinkTemplate('drupal:content-translation-overview'), $route); + $route_name = "entity.$entity_type_id.content_translation_overview"; + $collection->add($route_name, $route); $route = new Route( $path . '/add/{source}/{target}', diff --git a/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php index 1c6ff21..df14e15 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php @@ -62,6 +62,7 @@ protected function setupEntity() { // Create a translation. $this->drupalLogin($this->translator); $path = $this->entity->getSystemPath('drupal:content-translation-overview'); + $add_translation_path = $path . "/add/$default_langcode/{$this->langcodes[2]}"; $this->drupalPostForm($add_translation_path, array(), t('Save')); $this->rebuildContainer(); diff --git a/core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php b/core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php index b8d799a..1a58b31 100644 --- a/core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php +++ b/core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php @@ -28,7 +28,7 @@ protected function setUp() { ->method('getLinkTemplate') ->will($this->returnValueMap(array( array('canonical', 'entity.node.canonical'), - array('drupal:content-translation-overview', 'content_translation.translation_overview_node'), + array('drupal:content-translation-overview', 'entity.node.content_translation_overview'), ))); $content_translation_manager = $this->getMock('Drupal\content_translation\ContentTranslationManagerInterface'); $content_translation_manager->expects($this->any()) @@ -54,14 +54,14 @@ public function testBlockAdminDisplay($route, $expected) { public function providerTestBlockAdminDisplay() { return array( array('entity.node.canonical', array(array( - 'content_translation.local_tasks:content_translation.translation_overview_node', + 'content_translation.local_tasks:entity.node.content_translation_overview', 'entity.node.canonical', 'entity.node.edit_form', 'entity.node.delete_form', 'entity.node.version_history', ))), - array('content_translation.translation_overview_node', array(array( - 'content_translation.local_tasks:content_translation.translation_overview_node', + array('entity.node.content_translation_overview', array(array( + 'content_translation.local_tasks:entity.node.content_translation_overview', 'entity.node.canonical', 'entity.node.edit_form', 'entity.node.delete_form', diff --git a/core/modules/field/src/Entity/FieldConfig.php b/core/modules/field/src/Entity/FieldConfig.php index a8d9c0a..dc5607a 100644 --- a/core/modules/field/src/Entity/FieldConfig.php +++ b/core/modules/field/src/Entity/FieldConfig.php @@ -261,12 +261,12 @@ public static function postDelete(EntityStorageInterface $storage, array $fields protected function linkTemplates() { $link_templates = parent::linkTemplates(); if (\Drupal::moduleHandler()->moduleExists('field_ui')) { - $link_templates['edit-form'] = 'field_ui.field_edit_' . $this->entity_type; - $link_templates['storage-edit-form'] = 'field_ui.storage_edit_' . $this->entity_type; - $link_templates['delete-form'] = 'field_ui.delete_' . $this->entity_type; + $link_templates["{$this->entity_type}-field-edit-form"] = 'entity.field_config.' . $this->entity_type . '_field_edit_form'; + $link_templates["{$this->entity_type}-storage-edit-form"] = 'entity.field_config.' . $this->entity_type . '_storage_edit_form'; + $link_templates["{$this->entity_type}-field-delete-form"] = 'entity.field_config.' . $this->entity_type . '_field_delete_form'; - if (isset($link_templates['drupal:config-translation-overview'])) { - $link_templates['drupal:config-translation-overview'] .= $link_templates['edit-form']; + if (isset($link_templates['config-translation-overview'])) { + $link_templates["config-translation-overview.{$this->entity_type}"] = "entity.field_config.config_translation_overview.{$this->entity_type}"; } } return $link_templates; diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index bdd492a..c314a6c 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -51,7 +51,7 @@ function field_ui_help($route_name, RouteMatchInterface $route_match) { $output .= '
' . t('Fields on taxonomy terms are defined at the taxonomy vocabulary level, on the Manage fields tab of the vocabulary edit page (which you can reach from the Taxonomy page). When you define a field for a vocabulary, each term in that vocabulary will have that field added to it. For example, you could define an image field for a vocabulary to store an icon with each term.', array('@taxonomy' => \Drupal::url('taxonomy.vocabulary_list'))) . '
'; } $output .= '
' . t('Fields on user accounts') . '
'; - $output .= '
' . t('Fields on user accounts are defined on a site-wide basis on the Manage fields tab of the Account settings page. When you define a field for user accounts, each user account will have that field added to it. For example, you could add a long text field to allow users to include a biography.', array('@fields' => \Drupal::url('field_ui.overview_user'), '@accounts' => \Drupal::url('entity.user.admin_form'))) . '
'; + $output .= '
' . t('Fields on user accounts are defined on a site-wide basis on the Manage fields tab of the Account settings page. When you define a field for user accounts, each user account will have that field added to it. For example, you could add a long text field to allow users to include a biography.', array('@fields' => \Drupal::url('entity.user.field_ui_fields'), '@accounts' => \Drupal::url('entity.user.admin_form'))) . '
'; if ($module_handler->moduleExists('comment')) { $output .= '
' . t('Fields on comments') . '
'; $output .= '
' . t('Fields on comments are defined at the comment entity level, on the Manage fields tab of the comment types edit page (which you can reach from the Comment types page). When you add a field for comments, each comment on an entity with that comment type will have that field added to it. For example, you could add a website field to the comments on forum posts, to allow forum commenters to add a link to their website.', array('@types' => \Drupal::url('comment.type_list'))) . '
'; @@ -91,10 +91,14 @@ function field_ui_entity_type_build(array &$entity_types) { foreach ($entity_types as $entity_type) { if ($bundle = $entity_type->getBundleOf()) { + // To generate links in the UI we use the route names, so we don't have to + // know the exact required routes. + // This allows us to not require route information inside this hook, which + // otherwise could result in circular dependencies. $entity_type - ->setLinkTemplate('field_ui-fields', "field_ui.overview_$bundle") - ->setLinkTemplate('field_ui-form-display', "field_ui.form_display_overview_$bundle") - ->setLinkTemplate('field_ui-display', "field_ui.display_overview_$bundle"); + ->setLinkTemplate('field_ui-fields', "/admin/{$entity_type->id()}/fields") + ->setLinkTemplate('field_ui-form-display', "/admin/{$entity_type->id()}/fields-form-display") + ->setLinkTemplate('field_ui-display', "/admin/{$entity_type->id()}/fields-display"); } } } @@ -300,8 +304,8 @@ function field_ui_entity_type_alter(array &$entity_types) { $form_mode->setFormClass('edit', 'Drupal\field_ui\Form\EntityDisplayModeEditForm'); $form_mode->setFormClass('delete', 'Drupal\field_ui\Form\EntityDisplayModeDeleteForm'); $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('delete-form', '/admin/structure/display-modes/form/manage/{entity_form_mode}/delete'); + $form_mode->setLinkTemplate('edit-form', '/admin/structure/display-modes/form/manage/{entity_form_mode}'); $view_mode = $entity_types['entity_view_mode']; $view_mode->setListBuilderClass('Drupal\field_ui\EntityDisplayModeListBuilder'); @@ -309,6 +313,6 @@ function field_ui_entity_type_alter(array &$entity_types) { $view_mode->setFormClass('edit', 'Drupal\field_ui\Form\EntityDisplayModeEditForm'); $view_mode->setFormClass('delete', 'Drupal\field_ui\Form\EntityDisplayModeDeleteForm'); $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('delete-form', '/admin/structure/display-modes/view/manage/{entity_view_mode}/delete'); + $view_mode->setLinkTemplate('edit-form', '/admin/structure/display-modes/view/manage/{entity_view_mode}'); } diff --git a/core/modules/field_ui/field_ui.routing.yml b/core/modules/field_ui/field_ui.routing.yml index f507d1e..b7ab5b5 100644 --- a/core/modules/field_ui/field_ui.routing.yml +++ b/core/modules/field_ui/field_ui.routing.yml @@ -38,7 +38,7 @@ field_ui.entity_view_mode_add_type: requirements: _permission: 'administer display modes' -field_ui.entity_view_mode.edit_form: +entity.entity_view_mode.edit_form: path: '/admin/structure/display-modes/view/manage/{entity_view_mode}' defaults: _entity_form: 'entity_view_mode.edit' @@ -46,7 +46,7 @@ field_ui.entity_view_mode.edit_form: requirements: _entity_access: 'entity_view_mode.update' -field_ui.entity_view_mode.delete_form: +entity.entity_view_mode.delete_form: path: '/admin/structure/display-modes/view/manage/{entity_view_mode}/delete' defaults: _entity_form: 'entity_view_mode.delete' @@ -78,7 +78,7 @@ field_ui.entity_form_mode_add_type: requirements: _permission: 'administer display modes' -field_ui.entity_form_mode.edit_form: +entity.entity_form_mode.edit_form: path: '/admin/structure/display-modes/form/manage/{entity_form_mode}' defaults: _entity_form: 'entity_form_mode.edit' @@ -86,7 +86,7 @@ field_ui.entity_form_mode.edit_form: requirements: _entity_access: 'entity_form_mode.update' -field_ui.entity_form_mode.delete_form: +entity.entity_form_mode.delete_form: path: '/admin/structure/display-modes/form/manage/{entity_form_mode}/delete' defaults: _entity_form: 'entity_form_mode.delete' diff --git a/core/modules/field_ui/src/DisplayOverview.php b/core/modules/field_ui/src/DisplayOverview.php index b302529..5d6fd59 100644 --- a/core/modules/field_ui/src/DisplayOverview.php +++ b/core/modules/field_ui/src/DisplayOverview.php @@ -203,7 +203,9 @@ protected function getTableHeader() { * {@inheritdoc} */ protected function getOverviewRoute($mode) { - return Url::fromRoute('field_ui.display_overview_view_mode_' . $this->entity_type, [ + $entity_type = $this->entityManager->getDefinition($this->entity_type); + $field_entity_type = $entity_type->getBundleEntityType() != 'bundle'? $entity_type->getBundleEntityType() : $entity_type->id(); + return Url::fromRoute('field_ui.display_overview_view_mode_' . $field_entity_type, [ $this->bundleEntityTypeId => $this->bundle, 'view_mode_name' => $mode, ]); diff --git a/core/modules/field_ui/src/FieldConfigListBuilder.php b/core/modules/field_ui/src/FieldConfigListBuilder.php index ea5170f..35d72e3 100644 --- a/core/modules/field_ui/src/FieldConfigListBuilder.php +++ b/core/modules/field_ui/src/FieldConfigListBuilder.php @@ -139,7 +139,7 @@ public function buildRow(EntityInterface $field_config) { 'data' => array( '#type' => 'link', '#title' => $this->fieldTypeManager->getDefinitions()[$field_storage->getType()]['label'], - '#url' => Url::fromRoute('field_ui.storage_edit_' . $this->targetEntityTypeId, $route_parameters), + '#url' => Url::fromRoute("entity.field_config.{$this->targetEntityTypeId}_storage_edit_form", $route_parameters), '#options' => array('attributes' => array('title' => $this->t('Edit field settings.'))), ), ), @@ -164,11 +164,24 @@ public function getDefaultOperations(EntityInterface $entity) { /** @var \Drupal\field\FieldConfigInterface $entity */ $operations = parent::getDefaultOperations($entity); + if ($entity->access('update') && $entity->hasLinkTemplate("{$entity->entity_type}-field-edit-form")) { + $operations['edit'] = array( + 'title' => $this->t('Edit'), + 'weight' => 10, + ) + $entity->urlInfo("{$entity->entity_type}-field-edit-form")->toArray(); + } + if ($entity->access('delete') && $entity->hasLinkTemplate("{$entity->entity_type}-field-delete-form")) { + $operations['delete'] = array( + 'title' => $this->t('Delete'), + 'weight' => 100, + ) + $entity->urlInfo("{$entity->entity_type}-field-delete-form")->toArray(); + } + $operations['storage-settings'] = array( 'title' => $this->t('Storage settings'), 'weight' => 20, 'attributes' => array('title' => $this->t('Edit storage settings.')), - 'url' => $entity->urlInfo('storage-edit-form'), + 'url' => $entity->urlInfo("{$entity->entity_type}-storage-edit-form"), ); $operations['edit']['attributes']['title'] = $this->t('Edit field settings.'); $operations['delete']['attributes']['title'] = $this->t('Delete field.'); diff --git a/core/modules/field_ui/src/FieldUI.php b/core/modules/field_ui/src/FieldUI.php index 1658c79..4bbd93a 100644 --- a/core/modules/field_ui/src/FieldUI.php +++ b/core/modules/field_ui/src/FieldUI.php @@ -8,6 +8,7 @@ namespace Drupal\field_ui; use Drupal\Component\Utility\UrlHelper; +use Drupal\Core\Entity\EntityType; use Drupal\Core\Url; /** @@ -29,7 +30,8 @@ class FieldUI { public static function getOverviewRouteInfo($entity_type_id, $bundle) { $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); if ($entity_type->get('field_ui_base_route')) { - return new Url("field_ui.overview_$entity_type_id", array( + $bundle_entity_type = static::getRouteBundleEntityType($entity_type); + return new Url("entity.{$bundle_entity_type}.field_ui_fields", array( $entity_type->getBundleEntityType() => $bundle, )); } @@ -66,4 +68,18 @@ public static function getNextDestination(array $destinations) { return $next_destination; } + /** + * Gets the bundle entity type used for route names. + * + * This method returns the bundle entity type, in case there is one. + * + * @param \Drupal\Core\Entity\EntityType $entity_type + * The actual entity type, not the bundle. + * + * @return string + * The used entity type ID in the route name. + */ + public static function getRouteBundleEntityType(EntityType $entity_type) { + return $entity_type->getBundleEntityType() != 'bundle' ? $entity_type->getBundleEntityType() : $entity_type->id(); + } } diff --git a/core/modules/field_ui/src/Form/FieldEditForm.php b/core/modules/field_ui/src/Form/FieldEditForm.php index 8de533c..95985e5 100644 --- a/core/modules/field_ui/src/Form/FieldEditForm.php +++ b/core/modules/field_ui/src/Form/FieldEditForm.php @@ -223,7 +223,7 @@ public function delete(array &$form, FormStateInterface $form_state) { } $entity_type = $this->entityManager->getDefinition($this->field->entity_type); $form_state->setRedirect( - 'field_ui.delete_' . $this->field->entity_type, + 'entity.field_config.' . $this->field->entity_type . '_field_delete_form', array( $entity_type->getBundleEntityType() => $this->field->bundle, 'field_config' => $this->field->id(), diff --git a/core/modules/field_ui/src/Form/FieldStorageAddForm.php b/core/modules/field_ui/src/Form/FieldStorageAddForm.php index f4f2358..8e24e50 100644 --- a/core/modules/field_ui/src/Form/FieldStorageAddForm.php +++ b/core/modules/field_ui/src/Form/FieldStorageAddForm.php @@ -322,6 +322,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $error = FALSE; $values = $form_state->getValues(); $destinations = array(); + $entity_type = $this->entityManager->getDefinition($this->entityTypeId); + $bundle_entity_type = FieldUI::getRouteBundleEntityType($entity_type); // Create new field. if ($values['new_storage_type']) { @@ -352,9 +354,9 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $this->bundleEntityTypeId => $this->bundle, 'field_config' => $field->id(), ); - $destinations[] = array('route_name' => 'field_ui.storage_edit_' . $this->entityTypeId, 'route_parameters' => $route_parameters); - $destinations[] = array('route_name' => 'field_ui.field_edit_' . $this->entityTypeId, 'route_parameters' => $route_parameters); - $destinations[] = array('route_name' => 'field_ui.overview_' . $this->entityTypeId, 'route_parameters' => $route_parameters); + $destinations[] = array('route_name' => "entity.field_config.{$this->entityTypeId}_storage_edit_form", 'route_parameters' => $route_parameters); + $destinations[] = array('route_name' => "entity.field_config.{$this->entityTypeId}_field_edit_form", 'route_parameters' => $route_parameters); + $destinations[] = array('route_name' => "entity.{$bundle_entity_type}.field_ui_fields", 'route_parameters' => $route_parameters); // Store new field information for any additional submit handlers. $form_state->set(['fields_added', '_add_new_field'], $values['field_name']); @@ -384,8 +386,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $this->bundleEntityTypeId => $this->bundle, 'field_config' => $field->id(), ); - $destinations[] = array('route_name' => 'field_ui.field_edit_' . $this->entityTypeId, 'route_parameters' => $route_parameters); - $destinations[] = array('route_name' => 'field_ui.overview_' . $this->entityTypeId, 'route_parameters' => $route_parameters); + $destinations[] = array('route_name' => "entity.field_config.{$this->entityTypeId}_field_edit_form", 'route_parameters' => $route_parameters); + $destinations[] = array('route_name' => "entity.{$bundle_entity_type}.field_ui_fields", 'route_parameters' => $route_parameters); // Store new field information for any additional submit handlers. $form_state->set(['fields_added', '_add_existing_field'], $field_name); diff --git a/core/modules/field_ui/src/FormDisplayOverview.php b/core/modules/field_ui/src/FormDisplayOverview.php index 1728044..dd3363f 100644 --- a/core/modules/field_ui/src/FormDisplayOverview.php +++ b/core/modules/field_ui/src/FormDisplayOverview.php @@ -168,7 +168,9 @@ protected function getTableHeader() { * {@inheritdoc} */ protected function getOverviewRoute($mode) { - return Url::fromRoute('field_ui.form_display_overview_form_mode_' . $this->entity_type, [ + $entity_type = $this->entityManager->getDefinition($this->entity_type); + $field_entity_type = $entity_type->getBundleEntityType() != 'bundle'? $entity_type->getBundleEntityType() : $entity_type->id(); + return Url::fromRoute('field_ui.form_display_overview_form_mode_' . $field_entity_type, [ $this->bundleEntityTypeId => $this->bundle, 'form_mode_name' => $mode, ]); diff --git a/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalAction.php b/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalAction.php index 88b47e8..edc4309 100644 --- a/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalAction.php +++ b/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalAction.php @@ -12,6 +12,7 @@ use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; use Drupal\Core\Routing\RouteProviderInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\field_ui\FieldUI; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -59,10 +60,11 @@ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { if ($entity_type->get('field_ui_base_route')) { + $bundle_entity_type = FieldUI::getRouteBundleEntityType($entity_type); $this->derivatives["field_storage_config_add_$entity_type_id"] = array( 'route_name' => "field_ui.field_storage_config_add_$entity_type_id", 'title' => $this->t('Add field'), - 'appears_on' => array("field_ui.overview_$entity_type_id"), + 'appears_on' => array("entity.$bundle_entity_type.field_ui_fields"), ); } } diff --git a/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php b/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php index 5d56924..1a9f6d4 100644 --- a/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php +++ b/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php @@ -13,6 +13,7 @@ use Drupal\Core\Routing\RouteProviderInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\TranslationInterface; +use Drupal\field_ui\FieldUI; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -70,41 +71,43 @@ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { if ($entity_type->get('field_ui_base_route')) { - $this->derivatives["overview_$entity_type_id"] = array( - 'route_name' => "field_ui.overview_$entity_type_id", + $field_entity_type = FieldUI::getRouteBundleEntityType($entity_type); + + $this->derivatives["overview_$field_entity_type"] = array( + 'route_name' => "entity.$field_entity_type.field_ui_fields", 'weight' => 1, 'title' => $this->t('Manage fields'), - 'base_route' => "field_ui.overview_$entity_type_id", + 'base_route' => "entity.$field_entity_type.field_ui_fields", ); // 'Manage form display' tab. - $this->derivatives["form_display_overview_$entity_type_id"] = array( - 'route_name' => "field_ui.form_display_overview_$entity_type_id", + $this->derivatives["form_display_overview_$field_entity_type"] = array( + 'route_name' => "entity.{$field_entity_type}.field_ui_form_display", 'weight' => 2, 'title' => $this->t('Manage form display'), - 'base_route' => "field_ui.overview_$entity_type_id", + 'base_route' => "entity.$field_entity_type.field_ui_fields", ); // 'Manage display' tab. - $this->derivatives["display_overview_$entity_type_id"] = array( - 'route_name' => "field_ui.display_overview_$entity_type_id", + $this->derivatives["display_overview_$field_entity_type"] = array( + 'route_name' => "entity.{$field_entity_type}.field_ui_display", 'weight' => 3, 'title' => $this->t('Manage display'), - 'base_route' => "field_ui.overview_$entity_type_id", + 'base_route' => "entity.$field_entity_type.field_ui_fields", ); // Field edit tab. $this->derivatives["field_edit_$entity_type_id"] = array( - 'route_name' => "field_ui.field_edit_$entity_type_id", + 'route_name' => "entity.field_config.{$entity_type_id}_field_edit_form", 'title' => $this->t('Edit'), - 'base_route' => "field_ui.field_edit_$entity_type_id", + 'base_route' => "entity.field_config.{$entity_type_id}_field_edit_form", ); // Field settings tab. $this->derivatives["field_storage_$entity_type_id"] = array( - 'route_name' => "field_ui.storage_edit_$entity_type_id", + 'route_name' => "entity.field_config.{$entity_type_id}_storage_edit_form", 'title' => $this->t('Field settings'), - 'base_route' => "field_ui.field_edit_$entity_type_id", + 'base_route' => "entity.field_config.{$entity_type_id}_field_edit_form", ); // View and form modes secondary tabs. @@ -114,29 +117,29 @@ public function getDerivativeDefinitions($base_plugin_definition) { // modes available for customisation. So we define menu items for all // view modes, and use a route requirement to determine which ones are // actually visible for a given bundle. - $this->derivatives['field_form_display_default_' . $entity_type_id] = array( + $this->derivatives['field_form_display_default_' . $field_entity_type] = array( 'title' => 'Default', - 'route_name' => "field_ui.form_display_overview_$entity_type_id", - 'parent_id' => "field_ui.fields:form_display_overview_$entity_type_id", + 'route_name' => "entity.{$field_entity_type}.field_ui_form_display", + 'parent_id' => "field_ui.fields:form_display_overview_$field_entity_type", 'weight' => -1, ); - $this->derivatives['field_display_default_' . $entity_type_id] = array( + $this->derivatives['field_display_default_' . $field_entity_type] = array( 'title' => 'Default', - 'route_name' => "field_ui.display_overview_$entity_type_id", - 'parent_id' => "field_ui.fields:display_overview_$entity_type_id", + 'route_name' => "entity.{$field_entity_type}.field_ui_display", + 'parent_id' => "field_ui.fields:display_overview_$field_entity_type", 'weight' => -1, ); // One local task for each form mode. $weight = 0; foreach ($this->entityManager->getFormModes($entity_type_id) as $form_mode => $form_mode_info) { - $this->derivatives['field_form_display_' . $form_mode . '_' . $entity_type_id] = array( + $this->derivatives['field_form_display_' . $form_mode . '_' . $field_entity_type] = array( 'title' => $form_mode_info['label'], - 'route_name' => "field_ui.form_display_overview_form_mode_$entity_type_id", + 'route_name' => "field_ui.form_display_overview_form_mode_$field_entity_type", 'route_parameters' => array( 'form_mode_name' => $form_mode, ), - 'parent_id' => "field_ui.fields:form_display_overview_$entity_type_id", + 'parent_id' => "field_ui.fields:form_display_overview_$field_entity_type", 'weight' => $weight++, ); } @@ -144,13 +147,13 @@ public function getDerivativeDefinitions($base_plugin_definition) { // One local task for each view mode. $weight = 0; foreach ($this->entityManager->getViewModes($entity_type_id) as $view_mode => $form_mode_info) { - $this->derivatives['field_display_' . $view_mode . '_' . $entity_type_id] = array( + $this->derivatives['field_display_' . $view_mode . '_' . $field_entity_type] = array( 'title' => $form_mode_info['label'], - 'route_name' => "field_ui.display_overview_view_mode_$entity_type_id", + 'route_name' => "field_ui.display_overview_view_mode_$field_entity_type", 'route_parameters' => array( 'view_mode_name' => $view_mode, ), - 'parent_id' => "field_ui.fields:display_overview_$entity_type_id", + 'parent_id' => "field_ui.fields:display_overview_$field_entity_type", 'weight' => $weight++, ); } @@ -172,19 +175,21 @@ public function getDerivativeDefinitions($base_plugin_definition) { */ public function alterLocalTasks(&$local_tasks) { foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { + $field_entity_type = FieldUI::getRouteBundleEntityType($entity_type); + if ($route_name = $entity_type->get('field_ui_base_route')) { - $local_tasks["field_ui.fields:overview_$entity_type_id"]['base_route'] = $route_name; - $local_tasks["field_ui.fields:form_display_overview_$entity_type_id"]['base_route'] = $route_name; - $local_tasks["field_ui.fields:display_overview_$entity_type_id"]['base_route'] = $route_name; - $local_tasks["field_ui.fields:field_form_display_default_$entity_type_id"]['base_route'] = $route_name; - $local_tasks["field_ui.fields:field_display_default_$entity_type_id"]['base_route'] = $route_name; + $local_tasks["field_ui.fields:overview_$field_entity_type"]['base_route'] = $route_name; + $local_tasks["field_ui.fields:form_display_overview_$field_entity_type"]['base_route'] = $route_name; + $local_tasks["field_ui.fields:display_overview_$field_entity_type"]['base_route'] = $route_name; + $local_tasks["field_ui.fields:field_form_display_default_$field_entity_type"]['base_route'] = $route_name; + $local_tasks["field_ui.fields:field_display_default_$field_entity_type"]['base_route'] = $route_name; foreach ($this->entityManager->getFormModes($entity_type_id) as $form_mode => $form_mode_info) { - $local_tasks['field_ui.fields:field_form_display_' . $form_mode . '_' . $entity_type_id]['base_route'] = $route_name; + $local_tasks['field_ui.fields:field_form_display_' . $form_mode . '_' . $field_entity_type]['base_route'] = $route_name; } foreach ($this->entityManager->getViewModes($entity_type_id) as $view_mode => $form_mode_info) { - $local_tasks['field_ui.fields:field_display_' . $view_mode . '_' . $entity_type_id]['base_route'] = $route_name; + $local_tasks['field_ui.fields:field_display_' . $view_mode . '_' . $field_entity_type]['base_route'] = $route_name; } } } diff --git a/core/modules/field_ui/src/Routing/RouteSubscriber.php b/core/modules/field_ui/src/Routing/RouteSubscriber.php index 5e9c265..b35d7a0 100644 --- a/core/modules/field_ui/src/Routing/RouteSubscriber.php +++ b/core/modules/field_ui/src/Routing/RouteSubscriber.php @@ -54,6 +54,9 @@ protected function alterRoutes(RouteCollection $collection) { 'type' => 'entity:' . $entity_type->getBundleEntityType(), ); } + elseif ($bundle_entity_type == 'bundle') { + $bundle_entity_type = $entity_type_id; + } $route = new Route( "$path/fields/{field_config}", @@ -64,7 +67,7 @@ protected function alterRoutes(RouteCollection $collection) { array('_entity_access' => 'field_config.update'), $options ); - $collection->add("field_ui.field_edit_$entity_type_id", $route); + $collection->add("entity.field_config.{$entity_type_id}_field_edit_form", $route); $route = new Route( "$path/fields/{field_config}/storage", @@ -72,7 +75,7 @@ protected function alterRoutes(RouteCollection $collection) { array('_entity_access' => 'field_config.update'), $options ); - $collection->add("field_ui.storage_edit_$entity_type_id", $route); + $collection->add("entity.field_config.{$entity_type_id}_storage_edit_form", $route); $route = new Route( "$path/fields/{field_config}/delete", @@ -80,7 +83,7 @@ protected function alterRoutes(RouteCollection $collection) { array('_entity_access' => 'field_config.delete'), $options ); - $collection->add("field_ui.delete_$entity_type_id", $route); + $collection->add("entity.field_config.{$entity_type_id}_field_delete_form", $route); // If the entity type has no bundles, use the entity type. $defaults['entity_type_id'] = $entity_type_id; @@ -96,7 +99,7 @@ protected function alterRoutes(RouteCollection $collection) { array('_permission' => 'administer ' . $entity_type_id . ' fields'), $options ); - $collection->add("field_ui.overview_$entity_type_id", $route); + $collection->add("entity.$bundle_entity_type.field_ui_fields", $route); $route = new Route( "$path/fields/add-field", @@ -117,7 +120,7 @@ protected function alterRoutes(RouteCollection $collection) { array('_field_ui_form_mode_access' => 'administer ' . $entity_type_id . ' form display'), $options ); - $collection->add("field_ui.form_display_overview_$entity_type_id", $route); + $collection->add("entity.{$bundle_entity_type}.field_ui_form_display", $route); $route = new Route( "$path/form-display/{form_mode_name}", @@ -128,7 +131,7 @@ protected function alterRoutes(RouteCollection $collection) { array('_field_ui_form_mode_access' => 'administer ' . $entity_type_id . ' form display'), $options ); - $collection->add("field_ui.form_display_overview_form_mode_$entity_type_id", $route); + $collection->add("field_ui.form_display_overview_form_mode_$bundle_entity_type", $route); $route = new Route( "$path/display", @@ -139,7 +142,7 @@ protected function alterRoutes(RouteCollection $collection) { array('_field_ui_view_mode_access' => 'administer ' . $entity_type_id . ' display'), $options ); - $collection->add("field_ui.display_overview_$entity_type_id", $route); + $collection->add("entity.{$bundle_entity_type}.field_ui_display", $route); $route = new Route( "$path/display/{view_mode_name}", @@ -150,7 +153,7 @@ protected function alterRoutes(RouteCollection $collection) { array('_field_ui_view_mode_access' => 'administer ' . $entity_type_id . ' display'), $options ); - $collection->add("field_ui.display_overview_view_mode_$entity_type_id", $route); + $collection->add("field_ui.display_overview_view_mode_$bundle_entity_type", $route); } } } diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php index e628757..c51c282 100644 --- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php +++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php @@ -379,7 +379,7 @@ function testNoFieldsDisplayOverview() { ))->save(); $this->drupalGet('admin/structure/types/manage/no_fields/display'); - $this->assertRaw(t('There are no fields yet added. You can add new fields on the Manage fields page.', array('@link' => \Drupal::url('field_ui.overview_node', array('node_type' => 'no_fields'))))); + $this->assertRaw(t('There are no fields yet added. You can add new fields on the Manage fields page.', array('@link' => \Drupal::url('entity.node_type.field_ui_fields', array('node_type' => 'no_fields'))))); } /** diff --git a/core/modules/filter/src/Entity/FilterFormat.php b/core/modules/filter/src/Entity/FilterFormat.php index 4d45323..dc4643a 100644 --- a/core/modules/filter/src/Entity/FilterFormat.php +++ b/core/modules/filter/src/Entity/FilterFormat.php @@ -39,8 +39,8 @@ * "status" = "status" * }, * links = { - * "edit-form" = "entity.filter_format.edit_form", - * "disable" = "entity.filter_format.disable" + * "edit-form" = "/admin/config/content/formats/manage/{filter_format}", + * "disable" = "/admin/config/content/formats/manage/{filter_format}/disable" * } * ) */ diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 19db072..2fc361a 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -108,9 +108,9 @@ function forum_entity_type_build(array &$entity_types) { $entity_types['taxonomy_term'] ->setFormClass('forum', 'Drupal\forum\Form\ForumForm') ->setFormClass('container', 'Drupal\forum\Form\ContainerForm') - ->setLinkTemplate('forum-delete-form', 'entity.taxonomy_term.forum_delete_form') - ->setLinkTemplate('forum-edit-container-form', 'entity.taxonomy_term.forum_edit_container_form') - ->setLinkTemplate('forum-edit-form', 'entity.taxonomy_term.forum_edit_form'); + ->setLinkTemplate('forum-edit-container-form', '/admin/structure/forum/edit/container/{taxonomy_term}') + ->setLinkTemplate('forum-delete-form', '/admin/structure/forum/delete/forum/{taxonomy_term}') + ->setLinkTemplate('forum-edit-form', '/admin/structure/forum/edit/forum/{taxonomy_term}'); } /** diff --git a/core/modules/image/src/Entity/ImageStyle.php b/core/modules/image/src/Entity/ImageStyle.php index a57904d..a87554c 100644 --- a/core/modules/image/src/Entity/ImageStyle.php +++ b/core/modules/image/src/Entity/ImageStyle.php @@ -44,9 +44,9 @@ * "label" = "label" * }, * links = { - * "flush-form" = "entity.image_style.flush_form", - * "edit-form" = "entity.image_style.edit_form", - * "delete-form" = "entity.image_style.delete_form" + * "flush-form" = "/admin/config/media/image-styles/manage/{image_style}/flush", + * "edit-form" = "/admin/config/media/image-styles/manage/{image_style}", + * "delete-form" = "/admin/config/media/image-styles/manage/{image_style}/delete" * } * ) */ diff --git a/core/modules/language/src/Entity/ConfigurableLanguage.php b/core/modules/language/src/Entity/ConfigurableLanguage.php index 9a766d7..f2e128b 100644 --- a/core/modules/language/src/Entity/ConfigurableLanguage.php +++ b/core/modules/language/src/Entity/ConfigurableLanguage.php @@ -38,8 +38,8 @@ * "weight" = "weight" * }, * links = { - * "delete-form" = "entity.configurable_language.delete_form", - * "edit-form" = "entity.configurable_language.edit_form" + * "delete-form" = "/admin/config/regional/language/delete/{configurable_language}", + * "edit-form" = "/admin/config/regional/language/edit/{configurable_language}" * } * ) */ 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 92cdde3..8c00ee0 100644 --- a/core/modules/menu_link_content/menu_link_content.routing.yml +++ b/core/modules/menu_link_content/menu_link_content.routing.yml @@ -14,6 +14,14 @@ entity.menu_link_content.canonical: requirements: _entity_access: 'menu_link_content.update' +entity.menu_link_content.edit_form: + path: '/admin/structure/menu/item/{menu_link_content}/edit' + defaults: + _entity_form: 'menu_link_content.default' + _title: 'Edit menu link' + requirements: + _entity_access: 'menu_link_content.update' + entity.menu_link_content.delete_form: path: '/admin/structure/menu/item/{menu_link_content}/delete' defaults: diff --git a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php index 23ef1c4..152dc54 100644 --- a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php +++ b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php @@ -40,9 +40,9 @@ * "bundle" = "bundle" * }, * links = { - * "canonical" = "entity.menu_link_content.canonical", - * "edit-form" = "entity.menu_link_content.canonical", - * "delete-form" = "entity.menu_link_content.delete_form", + * "canonical" = "/admin/structure/menu/item/{menu_link_content}/edit", + * "edit-form" = "/admin/structure/menu/item/{menu_link_content}/edit", + * "delete-form" = "/admin/structure/menu/item/{menu_link_content}/delete", * } * ) */ diff --git a/core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php b/core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php index 8e3433b..34f38e2 100644 --- a/core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php +++ b/core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php @@ -194,7 +194,7 @@ public function getEditRoute() { * {@inheritdoc} */ public function getTranslateRoute() { - return $this->getEntity()->urlInfo('drupal:content-translation-overview'); + return $this->getEntity()->urlInfo('content-translation-overview'); } /** diff --git a/core/modules/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module index 5dda4ce..3656e5f 100644 --- a/core/modules/menu_ui/menu_ui.module +++ b/core/modules/menu_ui/menu_ui.module @@ -63,10 +63,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', '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-form', '/admin/structure/menu/add') + ->setLinkTemplate('delete-form', '/admin/structure/menu/manage/{menu}/delete') + ->setLinkTemplate('edit-form', '/admin/structure/menu/manage/{menu}') + ->setLinkTemplate('add-link-form', '/admin/structure/menu/manage/{menu}/add'); } /** diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 84a2d19..2cdbd6e 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -100,12 +100,12 @@ function node_help($route_name, RouteMatchInterface $route_match) { case 'node.type_add': return '

' . t('Individual content types can have different fields, behaviors, and permissions assigned to them.') . '

'; - case 'field_ui.form_display_overview_node': + case "entity.node.field_ui_form_display": case 'field_ui.form_display_overview_form_mode_node': $type = $route_match->getParameter('node_type'); return '

' . t('Content items can be edited using different form modes. Here, you can define which fields are shown and hidden when %type content is edited in each form mode, and define how the field form widgets are displayed in each form mode.', array('%type' => $type->label())) . '

' ; - case 'field_ui.display_overview_node': + case 'entity.node.field_ui_display': case 'field_ui.display_overview_view_mode_node': $type = $route_match->getParameter('node_type'); return '

' . t('Content items can be displayed using different view modes: Teaser, Full content, Print, RSS, etc. Teaser is a short format that is typically used in lists of multiple content items. Full content is typically used when the content is displayed on its own page.') . '

' . diff --git a/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php index 4e7dc84..40d0053 100644 --- a/core/modules/node/src/Entity/Node.php +++ b/core/modules/node/src/Entity/Node.php @@ -57,10 +57,10 @@ * field_ui_base_route = "entity.node_type.edit_form", * permission_granularity = "bundle", * links = { - * "canonical" = "entity.node.canonical", - * "delete-form" = "entity.node.delete_form", - * "edit-form" = "entity.node.edit_form", - * "version-history" = "entity.node.version_history", + * "canonical" = "/node/{node}", + * "delete-form" = "/node/{node}/delete", + * "edit-form" = "/node/{node}/edit", + * "version-history" = "/node/{node}/revisions", * } * ) */ diff --git a/core/modules/node/src/Entity/NodeType.php b/core/modules/node/src/Entity/NodeType.php index 6113247..8ba20e1 100644 --- a/core/modules/node/src/Entity/NodeType.php +++ b/core/modules/node/src/Entity/NodeType.php @@ -35,8 +35,8 @@ * "label" = "name" * }, * links = { - * "edit-form" = "entity.node_type.edit_form", - * "delete-form" = "entity.node_type.delete_form" + * "edit-form" = "/admin/structure/types/manage/{node_type}", + * "delete-form" = "/admin/structure/types/manage/{node_type}/delete" * } * ) */ diff --git a/core/modules/responsive_image/src/Entity/ResponsiveImageMapping.php b/core/modules/responsive_image/src/Entity/ResponsiveImageMapping.php index 3e8440e..f866656 100644 --- a/core/modules/responsive_image/src/Entity/ResponsiveImageMapping.php +++ b/core/modules/responsive_image/src/Entity/ResponsiveImageMapping.php @@ -33,8 +33,8 @@ * "label" = "label" * }, * links = { - * "edit-form" = "entity.responsive_image_mapping.edit_form", - * "duplicate-form" = "entity.responsive_image_mapping.duplicate_form" + * "edit-form" = "/admin/config/media/responsive-image-mapping/{responsive_image_mapping}", + * "duplicate-form" = "/admin/config/media/responsive-image-mapping/{responsive_image_mapping}/duplicate" * } * ) */ diff --git a/core/modules/rest/src/Plugin/Derivative/EntityDerivative.php b/core/modules/rest/src/Plugin/Derivative/EntityDerivative.php index 888a724..b7f02a7 100644 --- a/core/modules/rest/src/Plugin/Derivative/EntityDerivative.php +++ b/core/modules/rest/src/Plugin/Derivative/EntityDerivative.php @@ -110,7 +110,11 @@ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($default_uris as $link_relation => $default_uri) { // Check if there are link templates defined for the entity type and // use the path from the route instead of the default. - if ($route_name = $entity_type->getLinkTemplate($link_relation)) { + $link_template = $entity_type->getLinkTemplate($link_relation); + if (strpos($link_template, '/') !== FALSE) { + $this->derivatives[$entity_type_id]['uri_paths'][$link_relation] = '/' . $link_template; + } + elseif ($route_name = $link_template) { // @todo remove the try/catch as part of // http://drupal.org/node/2281645 try { diff --git a/core/modules/search/src/Entity/SearchPage.php b/core/modules/search/src/Entity/SearchPage.php index c2d0794..1ca1b54 100644 --- a/core/modules/search/src/Entity/SearchPage.php +++ b/core/modules/search/src/Entity/SearchPage.php @@ -35,11 +35,11 @@ * }, * admin_permission = "administer search", * links = { - * "edit-form" = "entity.search_page.edit_form", - * "delete-form" = "entity.search_page.delete_form", - * "enable" = "entity.search_page.enable", - * "disable" = "entity.search_page.disable", - * "set-default" = "entity.search_page.set_default" + * "edit-form" = "/admin/config/search/pages/manage/{search_page}", + * "delete-form" = "/admin/config/search/pages/manage/{search_page}/delete", + * "enable" = "/admin/config/search/pages/manage/{search_page}/enable", + * "disable" = "/admin/config/search/pages/manage/{search_page}/disable", + * "set-default" = "/admin/config/search/pages/manage/{search_page}/set-default" * }, * config_prefix = "page", * entity_keys = { diff --git a/core/modules/shortcut/shortcut.routing.yml b/core/modules/shortcut/shortcut.routing.yml index d8d8ea2..7fb1c09 100644 --- a/core/modules/shortcut/shortcut.routing.yml +++ b/core/modules/shortcut/shortcut.routing.yml @@ -62,6 +62,14 @@ entity.shortcut.canonical: requirements: _entity_access: 'shortcut.update' +entity.shortcut.edit_form: + path: '/admin/config/user-interface/shortcut/link/{shortcut}' + defaults: + _entity_form: 'shortcut.default' + _title: 'Edit' + requirements: + _entity_access: 'shortcut.update' + entity.shortcut.link_delete_inline: path: '/admin/config/user-interface/shortcut/link/{shortcut}/delete-inline' defaults: diff --git a/core/modules/shortcut/src/Entity/Shortcut.php b/core/modules/shortcut/src/Entity/Shortcut.php index ad43339..da40881 100644 --- a/core/modules/shortcut/src/Entity/Shortcut.php +++ b/core/modules/shortcut/src/Entity/Shortcut.php @@ -43,9 +43,9 @@ * "langcode" = "langcode", * }, * links = { - * "canonical" = "entity.shortcut.canonical", - * "delete-form" = "entity.shortcut.delete_form", - * "edit-form" = "entity.shortcut.canonical", + * "canonical" = "/admin/config/user-interface/shortcut/link/{shortcut}", + * "delete-form" = "/admin/config/user-interface/shortcut/link/{shortcut}/delete", + * "edit-form" = "/admin/config/user-interface/shortcut/link/{shortcut}", * }, * list_cache_tags = { "shortcut_set_list" }, * bundle_entity_type = "shortcut_set" diff --git a/core/modules/shortcut/src/Entity/ShortcutSet.php b/core/modules/shortcut/src/Entity/ShortcutSet.php index f72b7d0..2b862c5 100644 --- a/core/modules/shortcut/src/Entity/ShortcutSet.php +++ b/core/modules/shortcut/src/Entity/ShortcutSet.php @@ -36,9 +36,9 @@ * "label" = "label" * }, * links = { - * "customize-form" = "entity.shortcut_set.customize_form", - * "delete-form" = "entity.shortcut_set.delete_form", - * "edit-form" = "entity.shortcut_set.edit_form" + * "customize-form" = "/admin/config/user-interface/shortcut/manage/{shortcut_set}/customize", + * "delete-form" = "/admin/config/user-interface/shortcut/manage/{shortcut_set}/delete", + * "edit-form" = "/admin/config/user-interface/shortcut/manage/{shortcut_set}" * } * ) */ diff --git a/core/modules/system/entity.api.php b/core/modules/system/entity.api.php index 6a97060..f9cb41c 100644 --- a/core/modules/system/entity.api.php +++ b/core/modules/system/entity.api.php @@ -327,10 +327,11 @@ * also need to add a corresponding route to your module's routing.yml file; * see the entity.node.canonical route in node.routing.yml for an example, and see * @ref sec_routes below for some notes. - * - Define routing and links for the various URLs associated with the entity. + * - Define routes and links for the various URLs associated with the entity. * These go into the 'links' annotation, with the link type as the key, and - * the route machine name (defined in your module's routing.yml file) as the - * value; see @ref sec_routes below for some routing notes. Typical link + * the path of this link template. The corresponding route requires the + * following route name: "entity.$entity_type_id.$link_template_type". + * See @ref sec_routes below for some routing notes. Typical link * types are: * - canonical: Default link, either to view (if entities are viewed on their * own pages) or edit the entity. diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 8f2a8ab..676e0da 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1309,8 +1309,8 @@ function system_entity_type_build(array &$entity_types) { ->setFormClass('edit', 'Drupal\system\Form\DateFormatEditForm') ->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('edit-form', '/admin/config/regional/date-time/formats/manage/{date_format}') + ->setLinkTemplate('delete-form', '/admin/config/regional/date-time/formats/manage/{date_format}/delete'); } /** diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module index 6a6c6e2..f56a27e 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.module +++ b/core/modules/system/tests/modules/entity_test/entity_test.module @@ -27,6 +27,11 @@ const ENTITY_TEST_TYPES_MULTILINGUAL = 2; /** + * Filter that limits test entity list to routeable ones. + */ +const ENTITY_TEST_TYPES_ROUTING = 3; + +/** * Returns a list of test entity types. * * The returned entity types are one for each available entity storage type: @@ -47,7 +52,7 @@ */ function entity_test_entity_types($filter = NULL) { $types = array(); - if ($filter == NULL) { + if ($filter === NULL || $filter === ENTITY_TEST_TYPES_ROUTING) { $types[] = 'entity_test'; } if ($filter != ENTITY_TEST_TYPES_REVISABLE) { @@ -57,7 +62,11 @@ function entity_test_entity_types($filter = NULL) { if ($filter != ENTITY_TEST_TYPES_MULTILINGUAL) { $types[] = 'entity_test_rev'; } + if ($filter === ENTITY_TEST_TYPES_ROUTING) { + $types[] = 'entity_test_base_field_display'; + } $types[] = 'entity_test_mulrev'; + return array_combine($types, $types); } diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php index d9800be..0f444a1 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php @@ -41,9 +41,9 @@ * "langcode" = "langcode", * }, * links = { - * "canonical" = "entity.entity_test.canonical", - * "edit-form" = "entity.entity_test.edit_form", - * "delete-form" = "entity.entity_test.delete_form", + * "canonical" = "/entity_test/{entity_test}", + * "edit-form" = "/entity_test/manage/{entity_test}", + * "delete-form" = "/entity_test/delete/entity_test/{entity_test}", * }, * field_ui_base_route = "entity.entity_test.admin_form", * ) diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php index ed213e3..210eb53 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php @@ -30,7 +30,7 @@ * "bundle" = "type" * }, * links = { - * "edit-form" = "entity.entity_test_base_field_display.edit_form", + * "edit-form" = "/entity_test_base_field_display/manage/{entity_test_base_field_display}", * }, * field_ui_base_route = "entity.entity_test_base_field_display.admin_form", * ) diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php index cabb610..334ff94 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php @@ -38,9 +38,9 @@ * "langcode" = "langcode", * }, * links = { - * "canonical" = "entity.entity_test_mul.edit_form", - * "edit-form" = "entity.entity_test_mul.edit_form", - * "delete-form" = "entity.entity_test_mul.delete_form", + * "canonical" = "/entity_test_mul/manage/{entity_test_mul}", + * "edit-form" = "/entity_test_mul/manage/{entity_test_mul}", + * "delete-form" = "/entity_test/delete/entity_test_mul/{entity_test_mul}", * }, * field_ui_base_route = "entity.entity_test_mul.admin_form", * ) diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulDefaultValue.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulDefaultValue.php index fa3a60e..48b13e2 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulDefaultValue.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulDefaultValue.php @@ -37,9 +37,9 @@ * "langcode" = "langcode" * }, * links = { - * "canonical" = "entity.entity_test_mul.edit_form", - * "edit-form" = "entity.entity_test_mul.edit_form", - * "delete-form" = "entity.entity_test_mul.delete_form", + * "canonical" = "/entity_test_mul_default_value/manage/{entity_test_mul_default_value}", + * "edit-form" = "/entity_test_mul_default_value/manage/{entity_test_mul_default_value}", + * "delete-form" = "/entity_test/delete/entity_test_mul_default_value/{entity_test_mul_default_value}", * }, * field_ui_base_route = "entity.entity_test_mul.admin_form", * ) diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulLangcodeKey.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulLangcodeKey.php index 575d125..0b5585b 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulLangcodeKey.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulLangcodeKey.php @@ -36,9 +36,9 @@ * "langcode" = "custom_langcode_key", * }, * links = { - * "canonical" = "entity.entity_test_mul_langcode_key.edit_form", - * "edit-form" = "entity.entity_test_mul_langcode_key.edit_form", - * "delete-form" = "entity.entity_test_mul_langcode_key.delete_form", + * "canonical" = "/entity_test_mul_langcode_key/manage/{entity_test_mul_langcode_key}", + * "edit-form" = "/entity_test_mul_langcode_key/manage/{entity_test_mul_langcode_key}", + * "delete-form" = "/entity_test/delete/entity_test_mul_langcode_key/{entity_test_mul_langcode_key}", * }, * field_ui_base_route = "entity.entity_test_mul_langcode_key.admin_form", * ) diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php index 7fa29a9..94b4bbe 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php @@ -41,9 +41,9 @@ * "langcode" = "langcode", * }, * links = { - * "canonical" = "entity.entity_test_mulrev.edit_form", - * "delete-form" = "entity.entity_test_mulrev.delete_form", - * "edit-form" = "entity.entity_test_mulrev.edit_form" + * "canonical" = "/entity_test_mulrev/manage/{entity_test_mulrev}", + * "delete-form" = "/entity_test/delete/entity_test_mulrev/{entity_test_mulrev}", + * "edit-form" = "/entity_test_mulrev/manage/{entity_test_mulrev}", * } * ) */ diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php index f5bee90..3859a02 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php @@ -37,9 +37,9 @@ * "langcode" = "langcode", * }, * links = { - * "canonical" = "entity.entity_test_rev.edit_form", - * "delete-form" = "entity.entity_test_rev.delete_form", - * "edit-form" = "entity.entity_test_rev.edit_form" + * "canonical" = "/entity_test_rev/manage/{entity_test_rev}", + * "delete-form" = "/entity_test/delete/entity_test_rev/{entity_test_rev}", + * "edit-form" = "/entity_test_rev/manage/{entity_test_rev}" * } * ) */ diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php index 9d74938..7e057d4 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php @@ -29,8 +29,8 @@ * "bundle" = "type" * }, * links = { - * "canonical" = "entity.entity_test.canonical", - * "edit-form" = "entity.entity_test_string_id.edit_form", + * "canonical" = "/entity_test_string_id/manage/{entity_test_string_id}", + * "edit-form" = "/entity_test_string_id/manage/{entity_test_string_id}", * }, * field_ui_base_route = "entity.entity_test_string_id.admin_form", * ) diff --git a/core/modules/system/tests/modules/entity_test/src/Plugin/Derivative/EntityTestLocalTasks.php b/core/modules/system/tests/modules/entity_test/src/Plugin/Derivative/EntityTestLocalTasks.php index 7c7a90a..e4f8e49 100644 --- a/core/modules/system/tests/modules/entity_test/src/Plugin/Derivative/EntityTestLocalTasks.php +++ b/core/modules/system/tests/modules/entity_test/src/Plugin/Derivative/EntityTestLocalTasks.php @@ -19,13 +19,18 @@ class EntityTestLocalTasks extends DeriverBase { */ public function getDerivativeDefinitions($base_plugin_definition) { $this->derivatives = array(); - $types = entity_test_entity_types(); + $types = entity_test_entity_types(ENTITY_TEST_TYPES_ROUTING); foreach($types as $entity_type) { - $this->derivatives[$entity_type] = array(); - $this->derivatives[$entity_type]['base_route'] = "entity.$entity_type.edit_form"; - $this->derivatives[$entity_type]['route_name'] = "entity.$entity_type.edit_form"; - $this->derivatives[$entity_type]['title'] = 'Edit'; + $this->derivatives[$entity_type . '.canonical'] = array(); + $this->derivatives[$entity_type . '.canonical']['base_route'] = "entity.$entity_type.canonical"; + $this->derivatives[$entity_type . '.canonical']['route_name'] = "entity.$entity_type.canonical"; + $this->derivatives[$entity_type . '.canonical']['title'] = 'View'; + + $this->derivatives[$entity_type . '.edit'] = array(); + $this->derivatives[$entity_type . '.edit']['base_route'] = "entity.$entity_type.canonical"; + $this->derivatives[$entity_type . '.edit']['route_name'] = "entity.$entity_type.edit_form"; + $this->derivatives[$entity_type . '.edit']['title'] = 'Edit'; } return parent::getDerivativeDefinitions($base_plugin_definition); diff --git a/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php b/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php index 03e147c..53c1978 100644 --- a/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php +++ b/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php @@ -21,7 +21,7 @@ class EntityTestRoutes { * An array of route objects. */ public function routes() { - $types = entity_test_entity_types(); + $types = entity_test_entity_types(ENTITY_TEST_TYPES_ROUTING); $types[] = 'entity_test_string_id'; $types[] = 'entity_test_no_id'; @@ -33,6 +33,15 @@ public function routes() { array('_permission' => 'administer entity_test content') ); + $routes["entity.$entity_type_id.canonical"] = new Route( + $entity_type_id . '/manage/{' . $entity_type_id . '}', + array('_controller' => '\Drupal\entity_test\Controller\EntityTestController::testEdit', 'entity_type_id' => $entity_type_id), + array('_permission' => 'administer entity_test content'), + array('parameters' => array( + $entity_type_id => array('type' => 'entity:' . $entity_type_id), + )) + ); + $routes["entity.$entity_type_id.edit_form"] = new Route( $entity_type_id . '/manage/{' . $entity_type_id . '}', array('_controller' => '\Drupal\entity_test\Controller\EntityTestController::testEdit', 'entity_type_id' => $entity_type_id), diff --git a/core/modules/taxonomy/src/Entity/Term.php b/core/modules/taxonomy/src/Entity/Term.php index 93f9009..043c90d 100644 --- a/core/modules/taxonomy/src/Entity/Term.php +++ b/core/modules/taxonomy/src/Entity/Term.php @@ -46,9 +46,9 @@ * bundle_entity_type = "taxonomy_vocabulary", * field_ui_base_route = "entity.taxonomy_vocabulary.overview_form", * links = { - * "canonical" = "entity.taxonomy_term.canonical", - * "delete-form" = "entity.taxonomy_term.delete_form", - * "edit-form" = "entity.taxonomy_term.edit_form", + * "canonical" = "/taxonomy/term/{taxonomy_term}", + * "delete-form" = "/taxonomy/term/{taxonomy_term}/delete", + * "edit-form" = "/taxonomy/term/{taxonomy_term}/edit", * }, * permission_granularity = "bundle" * ) diff --git a/core/modules/taxonomy/src/Entity/Vocabulary.php b/core/modules/taxonomy/src/Entity/Vocabulary.php index 6d83fa7..ef831de 100644 --- a/core/modules/taxonomy/src/Entity/Vocabulary.php +++ b/core/modules/taxonomy/src/Entity/Vocabulary.php @@ -36,11 +36,11 @@ * "weight" = "weight" * }, * links = { - * "add-form" = "entity.taxonomy_term.add_form", - * "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" + * "add-form" = "/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/add", + * "delete-form" = "/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/delete", + * "reset-form" = "/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/reset", + * "overview-form" = "/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/overview", + * "edit-form" = "/admin/structure/taxonomy/manage/{taxonomy_vocabulary}" * } * ) */ diff --git a/core/modules/user/src/Entity/Role.php b/core/modules/user/src/Entity/Role.php index cad0530..9bda8d0 100644 --- a/core/modules/user/src/Entity/Role.php +++ b/core/modules/user/src/Entity/Role.php @@ -36,9 +36,9 @@ * "label" = "label" * }, * links = { - * "delete-form" = "entity.user_role.delete_form", - * "edit-form" = "entity.user_role.edit_form", - * "edit-permissions-form" = "entity.user_role.edit_permissions_form" + * "delete-form" = "/admin/people/roles/manage/{user_role}/delete", + * "edit-form" = "/admin/people/roles/manage/{user_role}", + * "edit-permissions-form" = "/admin/people/permissions/{user_role}" * } * ) */ diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php index 99c91db..7c8af82 100644 --- a/core/modules/user/src/Entity/User.php +++ b/core/modules/user/src/Entity/User.php @@ -51,9 +51,9 @@ * "uuid" = "uuid" * }, * links = { - * "canonical" = "entity.user.canonical", - * "edit-form" = "entity.user.edit_form", - * "cancel-form" = "entity.user.cancel_form", + * "canonical" = "/user/{user}", + * "edit-form" = "/user/{user}/edit", + * "cancel-form" = "/user/{user}/cancel", * }, * field_ui_base_route = "entity.user.admin_form", * ) diff --git a/core/modules/user/user.module b/core/modules/user/user.module index a251fd7..c3d125c 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -81,13 +81,13 @@ function user_help($route_name, RouteMatchInterface $route_match) { case 'user.role_list': return '

' . t('A role defines a group of users that have certain privileges. These privileges are defined on the Permissions page. Here, you can define the names and the display sort order of the roles on your site. It is recommended to order roles from least permissive (for example, Anonymous user) to most permissive (for example, Administrator user). Users who are not logged in have the Anonymous user role. Users who are logged in have the Authenticated user role, plus any other roles granted to their user account.', array('!permissions' => \Drupal::url('user.admin_permissions'))) . '

'; - case 'field_ui.overview_user': + case 'entity.user.field_ui_fields': return '

' . t('This form lets administrators add and edit fields for storing user data.') . '

'; - case 'field_ui.form_display_overview_user': + case 'entity.user.field_ui_form_display': return '

' . t('This form lets administrators configure how form fields should be displayed when editing a user profile.') . '

'; - case 'field_ui.display_overview_user': + case 'entity.node.field_ui_display': return '

' . t('This form lets administrators configure how fields should be displayed when rendering a user profile page.') . '

'; } } diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module index 7bf6e71..e9837eb 100644 --- a/core/modules/views_ui/views_ui.module +++ b/core/modules/views_ui/views_ui.module @@ -54,14 +54,14 @@ function views_ui_entity_type_build(array &$entity_types) { ->setFormClass('delete', 'Drupal\views_ui\ViewDeleteForm') ->setFormClass('break_lock', 'Drupal\views_ui\Form\BreakLockForm') ->setListBuilderClass('Drupal\views_ui\ViewListBuilder') - ->setLinkTemplate('edit-form', 'entity.view.edit_form') - ->setLinkTemplate('edit-display-form', 'entity.view.edit_display_form') - ->setLinkTemplate('preview-form', 'entity.view.preview_form') - ->setLinkTemplate('duplicate-form', 'entity.view.duplicate_form') - ->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('edit-form', '/admin/structure/views/view/{view}') + ->setLinkTemplate('edit-display-form', '/admin/structure/views/view/{view}/edit/{display_id}') + ->setLinkTemplate('preview-form', '/admin/structure/views/view/{view}/preview/{display_id}') + ->setLinkTemplate('duplicate-form', '/admin/structure/views/view/{view}/duplicate') + ->setLinkTemplate('delete-form', '/admin/structure/views/view/{view}/delete') + ->setLinkTemplate('enable', '/admin/structure/views/view/{view}/enable') + ->setLinkTemplate('disable', '/admin/structure/views/view/{view}/disable') + ->setLinkTemplate('break-lock-form', '/admin/structure/views/view/{view}/break-lock'); } /** diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php index c6d70ce..c4ae0b6 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php @@ -241,4 +241,14 @@ protected function getTestHandlerClass() { return get_class($this->getMockForAbstractClass('Drupal\Core\Entity\EntityHandlerBase')); } + /** + * @covers ::setLinkTemplate + * + * @expectedException \InvalidArgumentException + */ + public function testSetLinkTemplateWithInvalidPath() { + $entity_type = $this->setUpEntityType(['id' => $this->randomMachineName()]); + $entity_type->setLinkTemplate('test', 'invalid-path'); + } + } diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php index ba6f046..9a70b9f 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php @@ -65,10 +65,10 @@ public function testUrlInfo($entity_class, $link_template, $expected) { */ public function providerTestUrlInfo() { return array( - array('Drupal\Core\Entity\Entity', 'edit-form', 'test_entity_type.edit'), - array('Drupal\Core\Config\Entity\ConfigEntityBase', 'edit-form', 'test_entity_type.edit'), + array('Drupal\Core\Entity\Entity', 'edit-form', 'entity.test_entity_type.edit_form'), + array('Drupal\Core\Config\Entity\ConfigEntityBase', 'edit-form', 'entity.test_entity_type.edit_form'), // Test that overriding the default $rel parameter works. - array('Drupal\Core\Config\Entity\ConfigEntityBase', FALSE, 'test_entity_type.edit'), + array('Drupal\Core\Config\Entity\ConfigEntityBase', FALSE, 'entity.test_entity_type.edit_form'), ); } @@ -181,13 +181,13 @@ public function testUrl() { ->method('generateFromRoute') ->will($this->returnValueMap(array( array( - 'test_entity_type.view', + 'entity.test_entity_type.canonical', array('test_entity_type' => 'test_entity_id'), array('entity_type' => 'test_entity_type', 'entity' => $valid_entity), '/entity/test_entity_type/test_entity_id', ), array( - 'test_entity_type.view', + 'entity.test_entity_type.canonical', array('test_entity_type' => 'test_entity_id'), array('absolute' => TRUE, 'entity_type' => 'test_entity_type', 'entity' => $valid_entity), 'http://drupal/entity/test_entity_type/test_entity_id', @@ -208,7 +208,7 @@ public function testGetSystemPath() { $entity_type->expects($this->exactly(3)) ->method('getLinkTemplates') ->will($this->returnValue(array( - 'canonical' => 'test_entity_type.view', + 'canonical' => 'entity.test_entity_type.canonical', ))); $this->entityManager @@ -222,7 +222,7 @@ public function testGetSystemPath() { $this->urlGenerator->expects($this->once()) ->method('getPathFromRoute') - ->with('test_entity_type.view', array('test_entity_type' => 'test_entity_id')) + ->with('entity.test_entity_type.canonical', array('test_entity_type' => 'test_entity_id')) ->will($this->returnValue('entity/test_entity_type/test_entity_id')); $valid_entity = $this->getMockForAbstractClass('Drupal\Core\Entity\Entity', array(array('id' => 'test_entity_id'), 'test_entity_type'));