summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2013-11-15 13:31:24 (GMT)
committerAlex Pott2013-11-15 13:31:24 (GMT)
commit7b8e20411889ddead83846c93d4e523f9b5096eb (patch)
tree628a0acfb06e4907e7004cb075d5e987e99742b4
parentc4b089f5d9865c822b8620d44e9cf82186571e80 (diff)
Issue #2133469 by tim.plunkett, damiankloip, dawehner: Replace path-based entity links with route names.
-rw-r--r--core/lib/Drupal/Core/Entity/Annotation/EntityType.php4
-rw-r--r--core/lib/Drupal/Core/Entity/Entity.php31
-rw-r--r--core/modules/action/action.module2
-rw-r--r--core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php4
-rw-r--r--core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php2
-rw-r--r--core/modules/block/lib/Drupal/block/Entity/Block.php2
-rw-r--r--core/modules/comment/lib/Drupal/comment/Entity/Comment.php4
-rw-r--r--core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php4
-rw-r--r--core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigQueryTest.php3
-rw-r--r--core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php2
-rw-r--r--core/modules/contact/lib/Drupal/contact/Entity/Category.php2
-rw-r--r--core/modules/content_translation/content_translation.module44
-rw-r--r--core/modules/content_translation/content_translation.services.yml6
-rw-r--r--core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManager.php55
-rw-r--r--core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManagerInterface.php34
-rw-r--r--core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationContextualLinks.php2
-rw-r--r--core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php90
-rw-r--r--core/modules/content_translation/lib/Drupal/content_translation/Routing/ContentTranslationRouteSubscriber.php226
-rw-r--r--core/modules/content_translation/lib/Drupal/content_translation/Tests/ConfigTestTranslationUITest.php8
-rw-r--r--core/modules/content_translation/tests/Drupal/content_translation/Tests/Menu/ContentTranslationLocalTasksTest.php36
-rw-r--r--core/modules/entity/lib/Drupal/entity/Entity/EntityFormMode.php2
-rw-r--r--core/modules/entity/lib/Drupal/entity/Entity/EntityViewMode.php2
-rw-r--r--core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php2
-rw-r--r--core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php2
-rw-r--r--core/modules/image/lib/Drupal/image/Entity/ImageStyle.php2
-rw-r--r--core/modules/language/lib/Drupal/language/Entity/Language.php2
-rw-r--r--core/modules/menu/menu.module2
-rw-r--r--core/modules/node/lib/Drupal/node/Entity/Node.php6
-rw-r--r--core/modules/node/lib/Drupal/node/Entity/NodeType.php2
-rw-r--r--core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php2
-rw-r--r--core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaTestBase.php9
-rw-r--r--core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php2
-rw-r--r--core/modules/system/lib/Drupal/system/Entity/DateFormat.php2
-rw-r--r--core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php4
-rw-r--r--core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php4
-rw-r--r--core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php4
-rw-r--r--core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php4
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php4
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php2
-rw-r--r--core/modules/user/lib/Drupal/user/Entity/Role.php2
-rw-r--r--core/modules/user/lib/Drupal/user/Entity/User.php4
-rw-r--r--core/modules/views/lib/Drupal/views/Entity/View.php3
-rw-r--r--core/modules/views_ui/views_ui.module1
43 files changed, 364 insertions, 266 deletions
diff --git a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php
index 0171dd5..604bf5d 100644
--- a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php
+++ b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php
@@ -267,9 +267,7 @@ class EntityType extends Plugin {
*
* @var array
*/
- public $links = array(
- 'canonical' => '/entity/{entityType}/{id}',
- );
+ public $links = array();
/**
* Specifies whether a module exposing permissions for the current entity type
diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php
index 9d20fb9..745ef83 100644
--- a/core/lib/Drupal/Core/Entity/Entity.php
+++ b/core/lib/Drupal/Core/Entity/Entity.php
@@ -9,6 +9,7 @@ namespace Drupal\Core\Entity;
use Drupal\Core\Language\Language;
use Drupal\Core\Session\AccountInterface;
+use Symfony\Component\Routing\Exception\RouteNotFoundException;
/**
* Defines a base entity class.
@@ -37,6 +38,13 @@ abstract class Entity implements EntityInterface {
protected $enforceIsNew;
/**
+ * The route provider service.
+ *
+ * @var \Drupal\Core\Routing\RouteProviderInterface
+ */
+ protected $routeProvider;
+
+ /**
* Constructs an Entity object.
*
* @param array $values
@@ -144,10 +152,18 @@ abstract class Entity implements EntityInterface {
// The links array might contain URI templates set in annotations.
$link_templates = isset($entity_info['links']) ? $entity_info['links'] : array();
+ $template = NULL;
if (isset($link_templates[$rel])) {
+ try {
+ $template = $this->routeProvider()->getRouteByName($link_templates[$rel])->getPath();
+ }
+ catch (RouteNotFoundException $e) {
+ // Fall back to a non-template-based URI.
+ }
+ }
+ if ($template) {
// If there is a template for the given relationship type, do the
// placeholder replacement and use that as the path.
- $template = $link_templates[$rel];
$replacements = $this->uriPlaceholderReplacements();
$uri['path'] = str_replace(array_keys($replacements), array_values($replacements), $template);
@@ -369,4 +385,17 @@ abstract class Entity implements EntityInterface {
}
}
+ /**
+ * Wraps the route provider service.
+ *
+ * @return \Drupal\Core\Routing\RouteProviderInterface
+ * The route provider.
+ */
+ protected function routeProvider() {
+ if (!$this->routeProvider) {
+ $this->routeProvider = \Drupal::service('router.route_provider');
+ }
+ return $this->routeProvider;
+ }
+
}
diff --git a/core/modules/action/action.module b/core/modules/action/action.module
index 39fd855..5ecfb63 100644
--- a/core/modules/action/action.module
+++ b/core/modules/action/action.module
@@ -64,5 +64,5 @@ function action_entity_info(&$entity_info) {
$entity_info['action']['controllers']['form']['edit'] = 'Drupal\action\ActionEditFormController';
$entity_info['action']['controllers']['form']['delete'] = 'Drupal\action\Form\ActionDeleteForm';
$entity_info['action']['controllers']['list'] = 'Drupal\action\ActionListController';
- $entity_info['action']['links']['edit-form'] = 'admin/config/system/actions/configure/{action}';
+ $entity_info['action']['links']['edit-form'] = 'action.admin_configure';
}
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php
index 426b479..a83352b 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php
@@ -38,8 +38,8 @@ use Drupal\custom_block\CustomBlockInterface;
* revision_table = "custom_block_revision",
* route_base_path = "admin/structure/block/custom-blocks/manage/{bundle}",
* links = {
- * "canonical" = "/block/{custom_block}",
- * "edit-form" = "/block/{custom_block}"
+ * "canonical" = "custom_block.edit",
+ * "edit-form" = "custom_block.edit"
* },
* fieldable = TRUE,
* translatable = TRUE,
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php
index 8321d70..345c210 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php
@@ -38,7 +38,7 @@ use Drupal\custom_block\CustomBlockTypeInterface;
* "uuid" = "uuid"
* },
* links = {
- * "edit-form" = "admin/structure/block/custom-blocks/manage/{custom_block_type}"
+ * "edit-form" = "custom_block.type_edit"
* }
* )
*/
diff --git a/core/modules/block/lib/Drupal/block/Entity/Block.php b/core/modules/block/lib/Drupal/block/Entity/Block.php
index f433ea6..44fa169 100644
--- a/core/modules/block/lib/Drupal/block/Entity/Block.php
+++ b/core/modules/block/lib/Drupal/block/Entity/Block.php
@@ -38,7 +38,7 @@ use Drupal\Core\Entity\EntityStorageControllerInterface;
* "uuid" = "uuid"
* },
* links = {
- * "edit-form" = "admin/structure/block/manage/{block}"
+ * "edit-form" = "block.admin_edit"
* }
* )
*/
diff --git a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php
index 1db3983..4d22fbf 100644
--- a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php
+++ b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php
@@ -47,8 +47,8 @@ use Drupal\Core\Language\Language;
* "bundle" = "field_id"
* },
* links = {
- * "canonical" = "/comment/{comment}",
- * "edit-form" = "/comment/{comment}/edit"
+ * "canonical" = "comment.permalink",
+ * "edit-form" = "comment.edit_page"
* }
* )
*/
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php
index b26e7f2..d1dc721 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php
@@ -76,7 +76,7 @@ class ConfigEntityListTest extends WebTestBase {
$actual_operations = $controller->getOperations($entity);
// Sort the operations to normalize link order.
uasort($actual_operations, 'drupal_sort_weight');
- $this->assertIdentical($expected_operations, $actual_operations);
+ $this->assertIdentical($expected_operations, $actual_operations, 'The operations are identical.');
// Test buildHeader() method.
$expected_items = array(
@@ -149,7 +149,7 @@ class ConfigEntityListTest extends WebTestBase {
$actual_operations = $controller->getOperations($entity);
// Sort the operations to normalize link order.
uasort($actual_operations, 'drupal_sort_weight');
- $this->assertIdentical($expected_operations, $actual_operations);
+ $this->assertIdentical($expected_operations, $actual_operations, 'The operations are identical.');
}
/**
diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigQueryTest.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigQueryTest.php
index 5aed97f..a4c7e8c 100644
--- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigQueryTest.php
+++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigQueryTest.php
@@ -28,9 +28,6 @@ use Drupal\Core\Annotation\Translation;
* "id" = "id",
* "label" = "label",
* "uuid" = "uuid"
- * },
- * links = {
- * "edit-form" = "admin/structure/config_test/manage/{config_query_test}"
* }
* )
*
diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php
index 19ee07f..3df6365 100644
--- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php
+++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php
@@ -35,7 +35,7 @@ use Drupal\config_test\ConfigTestInterface;
* "status" = "status"
* },
* links = {
- * "edit-form" = "admin/structure/config_test/manage/{config_test}"
+ * "edit-form" = "config_test.entity"
* }
* )
*/
diff --git a/core/modules/contact/lib/Drupal/contact/Entity/Category.php b/core/modules/contact/lib/Drupal/contact/Entity/Category.php
index e636713..488f2e7 100644
--- a/core/modules/contact/lib/Drupal/contact/Entity/Category.php
+++ b/core/modules/contact/lib/Drupal/contact/Entity/Category.php
@@ -37,7 +37,7 @@ use Drupal\contact\CategoryInterface;
* "uuid" = "uuid"
* },
* links = {
- * "edit-form" = "admin/structure/contact/manage/{contact_category}"
+ * "edit-form" = "contact.category_edit"
* }
* )
*/
diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module
index ae4a86e..43127b0 100644
--- a/core/modules/content_translation/content_translation.module
+++ b/core/modules/content_translation/content_translation.module
@@ -90,19 +90,13 @@ function content_translation_entity_info_alter(array &$entity_info) {
}
if (!empty($info['links']['canonical'])) {
- // Provide default links for the translation paths.
+ // Provide default route names for the translation paths.
$info['links'] += array(
- 'drupal:content-translation-overview' => $info['links']['canonical'] . '/translations',
+ 'drupal:content-translation-overview' => "content_translation.translation_overview_$entity_type",
+ );
+ $info['translation']['content_translation'] += array(
+ 'access_callback' => 'content_translation_translate_access',
);
-
- $parts = explode('/', trim($info['links']['canonical'], '/'));
- $entity_position = array_search("{{$entity_type}}", $parts);
- if ($entity_position !== FALSE) {
- $info['translation']['content_translation'] += array(
- 'access_callback' => 'content_translation_translate_access',
- 'access_arguments' => array($entity_position),
- );
- }
}
}
}
@@ -162,7 +156,7 @@ function content_translation_menu() {
if (content_translation_enabled($entity_type)) {
$path = _content_translation_link_to_router_path($entity_type, $info['links']['canonical']);
$entity_position = count(explode('/', $path)) - 1;
- $keys = array_flip(array('theme_callback', 'theme_arguments', 'access_callback', 'access_arguments', 'load_arguments'));
+ $keys = array_flip(array('theme_callback', 'theme_arguments', 'load_arguments'));
$menu_info = array_intersect_key($info['translation']['content_translation'], $keys) + array('file' => 'content_translation.pages.inc');
$item = array();
@@ -174,7 +168,7 @@ function content_translation_menu() {
$items["$path/translations"] = array(
'title' => 'Translate',
- 'route_name' => "content_translation.translation_overview_$entity_type",
+ 'route_name' => $info['links']['drupal:content-translation-overview'],
'type' => MENU_LOCAL_TASK,
'context' => MENU_CONTEXT_PAGE,
'weight' => 2,
@@ -496,11 +490,13 @@ function content_translation_set_config($entity_type, $bundle, $setting, $value)
* @returns
* TRUE if the specified bundle is translatable. If no bundle is provided
* returns TRUE if at least one of the entity bundles is translatable.
+ *
+ * @todo Move to \Drupal\content_translation\ContentTranslationManager.
*/
function content_translation_enabled($entity_type, $bundle = NULL) {
$enabled = FALSE;
- if (content_translation_supported($entity_type)) {
+ if (\Drupal::service('content_translation.manager')->isSupported($entity_type)) {
$bundles = !empty($bundle) ? array($bundle) : array_keys(entity_get_bundles($entity_type));
foreach ($bundles as $bundle) {
if (content_translation_get_config($entity_type, $bundle, 'enabled')) {
@@ -514,20 +510,6 @@ function content_translation_enabled($entity_type, $bundle = NULL) {
}
/**
- * Checks whether an entity type supports translation.
- *
- * @param string $entity_type
- * The entity type.
- *
- * @return bool
- * TRUE if an entity type is supported, FALSE otherwise.
- */
-function content_translation_supported($entity_type) {
- $info = entity_get_info($entity_type);
- return !empty($info['translatable']) && !empty($info['links']['drupal:content-translation-overview']);
-}
-
-/**
* Content translation controller factory.
*
* @param string $entity_type
@@ -535,6 +517,8 @@ function content_translation_supported($entity_type) {
*
* @return \Drupal\content_translation\ContentTranslationControllerInterface
* An instance of the content translation controller interface.
+ *
+ * @todo Move to \Drupal\content_translation\ContentTranslationManager.
*/
function content_translation_controller($entity_type) {
$entity_info = entity_get_info($entity_type);
@@ -551,6 +535,8 @@ function content_translation_controller($entity_type) {
* @return \Drupal\Core\Entity\EntityFormControllerInterface;
* An instance of the content translation form interface or FALSE if not an
* entity form.
+ *
+ * @todo Move to \Drupal\content_translation\ContentTranslationManager.
*/
function content_translation_form_controller(array $form_state) {
return isset($form_state['controller']) && $form_state['controller'] instanceof EntityFormControllerInterface ? $form_state['controller'] : FALSE;
@@ -570,6 +556,8 @@ function content_translation_form_controller(array $form_state) {
*
* @return
* TRUE if the current user is allowed to view the translation.
+ *
+ * @todo Move to \Drupal\content_translation\ContentTranslationManager.
*/
function content_translation_access(EntityInterface $entity, $op) {
return content_translation_controller($entity->entityType())->getTranslationAccess($entity, $op) ;
diff --git a/core/modules/content_translation/content_translation.services.yml b/core/modules/content_translation/content_translation.services.yml
index e81c13d..73ad8ea 100644
--- a/core/modules/content_translation/content_translation.services.yml
+++ b/core/modules/content_translation/content_translation.services.yml
@@ -5,7 +5,7 @@ services:
content_translation.subscriber:
class: Drupal\content_translation\Routing\ContentTranslationRouteSubscriber
- arguments: ['@plugin.manager.entity']
+ arguments: ['@content_translation.manager', '@router.route_provider']
tags:
- { name: event_subscriber }
@@ -20,3 +20,7 @@ services:
arguments: ['@plugin.manager.entity']
tags:
- { name: access_check }
+
+ content_translation.manager:
+ class: Drupal\content_translation\ContentTranslationManager
+ arguments: ['@entity.manager']
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManager.php b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManager.php
new file mode 100644
index 0000000..1f98147
--- /dev/null
+++ b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManager.php
@@ -0,0 +1,55 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\content_translation\ContentTranslationManager.
+ */
+
+namespace Drupal\content_translation;
+
+use Drupal\Core\Entity\EntityManagerInterface;
+
+/**
+ * Provides common functionality for content translation.
+ */
+class ContentTranslationManager implements ContentTranslationManagerInterface {
+
+ /**
+ * The entity type manager.
+ *
+ * @var \Drupal\Core\Entity\EntityManagerInterface
+ */
+ protected $entityManager;
+
+ /**
+ * Constructs a ContentTranslationManageAccessCheck object.
+ *
+ * @param \Drupal\Core\Entity\EntityManagerInterface $manager
+ * The entity type manager.
+ */
+ public function __construct(EntityManagerInterface $manager) {
+ $this->entityManager = $manager;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isSupported($entity_type) {
+ $info = $this->entityManager->getDefinition($entity_type);
+ return !empty($info['translatable']) && !empty($info['links']['drupal:content-translation-overview']);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedEntityTypes() {
+ $supported_types = array();
+ foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) {
+ if ($this->isSupported($entity_type)) {
+ $supported_types[$entity_type] = $entity_info;
+ }
+ }
+ return $supported_types;
+ }
+
+}
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManagerInterface.php b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManagerInterface.php
new file mode 100644
index 0000000..92ff0fd
--- /dev/null
+++ b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationManagerInterface.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\content_translation\ContentTranslationManagerInterface.
+ */
+
+namespace Drupal\content_translation;
+
+/**
+ * Provides an interface for common functionality for content translation.
+ */
+interface ContentTranslationManagerInterface {
+
+ /**
+ * Gets the entity types that support content translation.
+ *
+ * @return array
+ * An array of entity types that support content translation.
+ */
+ public function getSupportedEntityTypes();
+
+ /**
+ * Checks whether an entity type supports translation.
+ *
+ * @param string $entity_type
+ * The entity type.
+ *
+ * @return bool
+ * TRUE if an entity type is supported, FALSE otherwise.
+ */
+ public function isSupported($entity_type);
+
+}
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationContextualLinks.php b/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationContextualLinks.php
index c6cc8ea..98956ab 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationContextualLinks.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationContextualLinks.php
@@ -54,7 +54,7 @@ class ContentTranslationContextualLinks extends DerivativeBase implements Contai
foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) {
if ($entity_info['translatable'] && isset($entity_info['translation'])) {
$this->derivatives[$entity_type]['title'] = t('Translate');
- $this->derivatives[$entity_type]['route_name'] = "content_translation.translation_overview_$entity_type";
+ $this->derivatives[$entity_type]['route_name'] = $entity_info['links']['drupal:content-translation-overview'];
$this->derivatives[$entity_type]['group'] = $entity_type;
}
}
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php b/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php
index f7da9a7..0d6e1ba 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php
@@ -8,9 +8,8 @@
namespace Drupal\content_translation\Plugin\Derivative;
use Drupal\Component\Plugin\Derivative\DerivativeBase;
-use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\content_translation\ContentTranslationManagerInterface;
use Drupal\Core\Plugin\Discovery\ContainerDerivativeInterface;
-use Drupal\Core\Routing\RouteProviderInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -19,40 +18,30 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class ContentTranslationLocalTasks extends DerivativeBase implements ContainerDerivativeInterface {
/**
- * The entity manager.
- *
- * @var \Drupal\Core\Entity\EntityManagerInterface
- */
- protected $entityManager;
-
- /**
- * The route provider.
+ * The base plugin ID
*
- * @var \Drupal\Core\Routing\RouteProviderInterface
+ * @var string
*/
- protected $routeProvider;
+ protected $basePluginId;
/**
- * The base plugin ID
+ * The content translation manager.
*
- * @var string
+ * @var \Drupal\content_translation\ContentTranslationManagerInterface
*/
- protected $basePluginId;
+ protected $contentTranslationManager;
/**
* Constructs a new ContentTranslationLocalTasks.
*
* @param string $base_plugin_id
* The base plugin ID.
- * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
- * The entity manager.
- * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
- * The route provider.
+ * @param \Drupal\content_translation\ContentTranslationManagerInterface $content_translation_manager
+ * The content translation manager.
*/
- public function __construct($base_plugin_id, EntityManagerInterface $entity_manager, RouteProviderInterface $route_provider) {
- $this->entityManager = $entity_manager;
- $this->routeProvider = $route_provider;
+ public function __construct($base_plugin_id, ContentTranslationManagerInterface $content_translation_manager) {
$this->basePluginId = $base_plugin_id;
+ $this->contentTranslationManager = $content_translation_manager;
}
/**
@@ -61,8 +50,7 @@ class ContentTranslationLocalTasks extends DerivativeBase implements ContainerDe
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static(
$base_plugin_id,
- $container->get('entity.manager'),
- $container->get('router.route_provider')
+ $container->get('content_translation.manager')
);
}
@@ -71,18 +59,15 @@ class ContentTranslationLocalTasks extends DerivativeBase implements ContainerDe
*/
public function getDerivativeDefinitions(array $base_plugin_definition) {
// Create tabs for all possible entity types.
- foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) {
- if (!empty($entity_info['translatable'])) {
- // Find the route name for the translation overview.
- $translation_route_name = "content_translation.translation_overview_$entity_type";
- $translation_tab = $translation_route_name;
-
- $this->derivatives[$translation_tab] = $base_plugin_definition + array(
- 'entity_type' => $entity_type,
- );
- $this->derivatives[$translation_tab]['title'] = 'Translate';
- $this->derivatives[$translation_tab]['route_name'] = $translation_route_name;
- }
+ foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type => $entity_info) {
+ // Find the route name for the translation overview.
+ $translation_route_name = $entity_info['links']['drupal:content-translation-overview'];
+
+ $this->derivatives[$translation_route_name] = array(
+ 'entity_type' => $entity_type,
+ 'title' => 'Translate',
+ 'route_name' => $translation_route_name,
+ ) + $base_plugin_definition;
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
@@ -91,20 +76,15 @@ class ContentTranslationLocalTasks extends DerivativeBase implements ContainerDe
* Alters the local tasks to find the proper tab_root_id for each task.
*/
public function alterLocalTasks(array &$local_tasks) {
- foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) {
- if (!empty($entity_info['translatable']) && !empty($entity_info['links']['canonical'])) {
- $path = $entity_info['links']['canonical'];
- if ($routes = $this->routeProvider->getRoutesByPattern($path)->all()) {
- // Find the route name for the entity page.
- $entity_route_name = key($routes);
-
- // Find the route name for the translation overview.
- $translation_route_name = "content_translation.translation_overview_$entity_type";
- $translation_tab = $this->basePluginId . ':' . $translation_route_name;
-
- $local_tasks[$translation_tab]['tab_root_id'] = $this->getTaskFromRoute($entity_route_name, $local_tasks);
- }
- }
+ foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_info) {
+ // Find the route name for the entity page.
+ $entity_route_name = $entity_info['links']['canonical'];
+
+ // Find the route name for the translation overview.
+ $translation_route_name = $entity_info['links']['drupal:content-translation-overview'];
+ $translation_tab = $this->basePluginId . ':' . $translation_route_name;
+
+ $local_tasks[$translation_tab]['tab_root_id'] = $this->getTaskFromRoute($entity_route_name, $local_tasks);
}
}
@@ -131,14 +111,4 @@ class ContentTranslationLocalTasks extends DerivativeBase implements ContainerDe
return $parent_local_task;
}
- /**
- * Translates a string to the current language or to a given language.
- *
- * See the t() documentation for details.
- *
- * @todo Move to derivative base. https://drupal.org/node/2112575
- */
- public function t($string, array $args = array(), array $options = array()) {
- \Drupal::translation()->translate($string, $args, $options);
- }
}
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Routing/ContentTranslationRouteSubscriber.php b/core/modules/content_translation/lib/Drupal/content_translation/Routing/ContentTranslationRouteSubscriber.php
index 368dc27..08dddca 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Routing/ContentTranslationRouteSubscriber.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Routing/ContentTranslationRouteSubscriber.php
@@ -7,10 +7,13 @@
namespace Drupal\content_translation\Routing;
-use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\content_translation\ContentTranslationManagerInterface;
+use Drupal\Core\Routing\RouteProviderInterface;
use Drupal\Core\Routing\RouteSubscriberBase;
+use Drupal\Core\Routing\RoutingEvents;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
+use Symfony\Component\Routing\Exception\RouteNotFoundException;
/**
* Subscriber for entity translation routes.
@@ -18,125 +21,154 @@ use Symfony\Component\Routing\RouteCollection;
class ContentTranslationRouteSubscriber extends RouteSubscriberBase {
/**
- * The entity type manager.
+ * The content translation manager.
*
- * @var \Drupal\Core\Entity\EntityManagerInterface
+ * @var \Drupal\content_translation\ContentTranslationManagerInterface
*/
- protected $entityManager;
+ protected $contentTranslationManager;
+
+ /**
+ * The route provider.
+ *
+ * @var \Drupal\Core\Routing\RouteProviderInterface
+ */
+ protected $routeProvider;
/**
* Constructs a ContentTranslationRouteSubscriber object.
*
- * @param \Drupal\Core\Entity\EntityManagerInterface $entityManager
- * The entity type manager.
+ * @param \Drupal\content_translation\ContentTranslationManagerInterface $content_translation_manager
+ * The content translation manager.
+ * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
+ * The route provider.
*/
- public function __construct(EntityManagerInterface $entityManager) {
- $this->entityManager = $entityManager;
+ public function __construct(ContentTranslationManagerInterface $content_translation_manager, RouteProviderInterface $route_provider) {
+ $this->contentTranslationManager = $content_translation_manager;
+ $this->routeProvider = $route_provider;
}
/**
* {@inheritdoc}
*/
protected function routes(RouteCollection $collection) {
- foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) {
- if (!empty($entity_info['translatable']) && !empty($entity_info['links']['drupal:content-translation-overview'])) {
- $path = $entity_info['links']['drupal:content-translation-overview'];
+ foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type => $entity_info) {
+ // First try to get the route from the dynamic_routes collection.
+ if (!$entity_route = $collection->get($entity_info['links']['canonical'])) {
+ // Then try to get the route from the route provider itself, checking
+ // all previous collections.
+ try {
+ $entity_route = $this->routeProvider->getRouteByName($entity_info['links']['canonical']);
+ }
+ // If the route was not found, skip this entity type.
+ catch (RouteNotFoundException $e) {
+ continue;
+ }
+ }
+ $path = $entity_route->getPath() . '/translations';
- $route = new Route(
- $path,
- array(
- '_content' => '\Drupal\content_translation\Controller\ContentTranslationController::overview',
- '_title' => 'Translate',
- 'account' => 'NULL',
- '_entity_type' => $entity_type,
- ),
- array(
- '_access_content_translation_overview' => $entity_type,
- '_permission' => 'translate any entity',
- ),
- array(
- '_access_mode' => 'ANY',
- 'parameters' => array(
- 'entity' => array(
- 'type' => 'entity:' . $entity_type,
- ),
+ $route = new Route(
+ $path,
+ array(
+ '_content' => '\Drupal\content_translation\Controller\ContentTranslationController::overview',
+ '_title' => 'Translate',
+ 'account' => 'NULL',
+ '_entity_type' => $entity_type,
+ ),
+ array(
+ '_access_content_translation_overview' => $entity_type,
+ '_permission' => 'translate any entity',
+ ),
+ array(
+ '_access_mode' => 'ANY',
+ 'parameters' => array(
+ 'entity' => array(
+ 'type' => 'entity:' . $entity_type,
),
- )
- );
- $collection->add("content_translation.translation_overview_$entity_type", $route);
+ ),
+ )
+ );
+ $collection->add($entity_info['links']['drupal:content-translation-overview'], $route);
- $route = new Route(
- $path . '/add/{source}/{target}',
- array(
- '_content' => '\Drupal\content_translation\Controller\ContentTranslationController::add',
- 'source' => NULL,
- 'target' => NULL,
- '_title' => 'Add',
- '_entity_type' => $entity_type,
+ $route = new Route(
+ $path . '/add/{source}/{target}',
+ array(
+ '_content' => '\Drupal\content_translation\Controller\ContentTranslationController::add',
+ 'source' => NULL,
+ 'target' => NULL,
+ '_title' => 'Add',
+ '_entity_type' => $entity_type,
- ),
- array(
- '_permission' => 'translate any entity',
- '_access_content_translation_manage' => 'create',
- ),
- array(
- '_access_mode' => 'ANY',
- 'parameters' => array(
- 'entity' => array(
- 'type' => 'entity:' . $entity_type,
- ),
+ ),
+ array(
+ '_permission' => 'translate any entity',
+ '_access_content_translation_manage' => 'create',
+ ),
+ array(
+ '_access_mode' => 'ANY',
+ 'parameters' => array(
+ 'entity' => array(
+ 'type' => 'entity:' . $entity_type,
),
- )
- );
- $collection->add("content_translation.translation_add_$entity_type", $route);
-
- $route = new Route(
- $path . '/edit/{language}',
- array(
- '_content' => '\Drupal\content_translation\Controller\ContentTranslationController::edit',
- 'language' => NULL,
- '_title' => 'Edit',
- '_entity_type' => $entity_type,
- ),
- array(
- '_permission' => 'translate any entity',
- '_access_content_translation_manage' => 'update',
),
- array(
- '_access_mode' => 'ANY',
- 'parameters' => array(
- 'entity' => array(
- 'type' => 'entity:' . $entity_type,
- ),
- ),
- )
- );
- $collection->add("content_translation.translation_edit_$entity_type", $route);
+ )
+ );
+ $collection->add("content_translation.translation_add_$entity_type", $route);
- $route = new Route(
- $path . '/delete/{language}',
- array(
- '_content' => '\Drupal\content_translation\Form\ContentTranslationForm::deleteTranslation',
- 'language' => NULL,
- '_title' => 'Delete',
- '_entity_type' => $entity_type,
- ),
- array(
- '_permission' => 'translate any entity',
- '_access_content_translation_manage' => 'delete',
+ $route = new Route(
+ $path . '/edit/{language}',
+ array(
+ '_content' => '\Drupal\content_translation\Controller\ContentTranslationController::edit',
+ 'language' => NULL,
+ '_title' => 'Edit',
+ '_entity_type' => $entity_type,
+ ),
+ array(
+ '_permission' => 'translate any entity',
+ '_access_content_translation_manage' => 'update',
+ ),
+ array(
+ '_access_mode' => 'ANY',
+ 'parameters' => array(
+ 'entity' => array(
+ 'type' => 'entity:' . $entity_type,
+ ),
),
- array(
- 'parameters' => array(
- 'entity' => array(
- 'type' => 'entity:' . $entity_type,
- ),
+ )
+ );
+ $collection->add("content_translation.translation_edit_$entity_type", $route);
+
+ $route = new Route(
+ $path . '/delete/{language}',
+ array(
+ '_content' => '\Drupal\content_translation\Form\ContentTranslationForm::deleteTranslation',
+ 'language' => NULL,
+ '_title' => 'Delete',
+ '_entity_type' => $entity_type,
+ ),
+ array(
+ '_permission' => 'translate any entity',
+ '_access_content_translation_manage' => 'delete',
+ ),
+ array(
+ 'parameters' => array(
+ 'entity' => array(
+ 'type' => 'entity:' . $entity_type,
),
- '_access_mode' => 'ANY',
- )
- );
- $collection->add("content_translation.delete_$entity_type", $route);
- }
+ ),
+ '_access_mode' => 'ANY',
+ )
+ );
+ $collection->add("content_translation.delete_$entity_type", $route);
}
}
+ /**
+ * {@inheritdoc}
+ */
+ public static function getSubscribedEvents() {
+ $events = parent::getSubscribedEvents();
+ $events[RoutingEvents::DYNAMIC] = array('onDynamicRoutes', -100);
+ return $events;
+ }
+
}
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ConfigTestTranslationUITest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ConfigTestTranslationUITest.php
index a83e3f9..1e1e997 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ConfigTestTranslationUITest.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ConfigTestTranslationUITest.php
@@ -54,6 +54,14 @@ class ConfigTestTranslationUITest extends ContentTranslationUITest {
}
/**
+ * {@inheritdoc}
+ */
+ protected function getTranslatePermission() {
+ // There is no valid translation permission.
+ return;
+ }
+
+ /**
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::::testTranslationUI().
*
* @todo Config entities are not translatable, but Content Translation module
diff --git a/core/modules/content_translation/tests/Drupal/content_translation/Tests/Menu/ContentTranslationLocalTasksTest.php b/core/modules/content_translation/tests/Drupal/content_translation/Tests/Menu/ContentTranslationLocalTasksTest.php
index a83ee6f..48fe2a5 100644
--- a/core/modules/content_translation/tests/Drupal/content_translation/Tests/Menu/ContentTranslationLocalTasksTest.php
+++ b/core/modules/content_translation/tests/Drupal/content_translation/Tests/Menu/ContentTranslationLocalTasksTest.php
@@ -32,43 +32,19 @@ class ContentTranslationLocalTasksTest extends LocalTaskIntegrationTest {
);
parent::setUp();
- // Entity manager stub for derivative building.
- $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
- $entity_manager->expects($this->any())
- ->method('getDefinitions')
+ $content_translation_manager = $this->getMock('Drupal\content_translation\ContentTranslationManagerInterface');
+ $content_translation_manager->expects($this->any())
+ ->method('getSupportedEntityTypes')
->will($this->returnValue(array(
'node' => array(
'translatable' => TRUE,
'links' => array(
- 'canonical' => '/node/{node}',
+ 'canonical' => 'node.view',
+ 'drupal:content-translation-overview' => 'content_translation.translation_overview_node',
),
),
)));
- \Drupal::getContainer()->set('entity.manager', $entity_manager);
-
- // Route provider for injecting node.view into derivative lookup.
- $collection = $this->getMockBuilder('Symfony\Component\Routing\RouteCollection')
- ->disableOriginalConstructor()
- ->setMethods(array('all'))
- ->getMock();
- $collection->expects($this->any())
- ->method('all')
- ->will($this->returnValue(array('node.view' => array())));
- $route_provider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
- $route_provider->expects($this->any())
- ->method('getRoutesByPattern')
- ->will($this->returnValue($collection));
- \Drupal::getContainer()->set('router.route_provider', $route_provider);
-
- // Stub for t().
- $string_translation = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
- $string_translation->expects($this->any())
- ->method('translate')
- ->will($this->returnCallback(function($string) {return $string;}));
- \Drupal::getContainer()->set('string_translation', $string_translation);
-
- // Load the content_translation.module file in order to run the alter hook.
- require_once DRUPAL_ROOT . '/core/modules/content_translation/content_translation.module';
+ \Drupal::getContainer()->set('content_translation.manager', $content_translation_manager);
}
/**
diff --git a/core/modules/entity/lib/Drupal/entity/Entity/EntityFormMode.php b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormMode.php
index 533321c..8e2284b 100644
--- a/core/modules/entity/lib/Drupal/entity/Entity/EntityFormMode.php
+++ b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormMode.php
@@ -49,7 +49,7 @@ use Drupal\entity\EntityFormModeInterface;
* "uuid" = "uuid"
* },
* links = {
- * "edit-form" = "admin/structure/display-modes/form/manage/{form_mode}"
+ * "edit-form" = "entity.form_mode_edit"
* }
* )
*/
diff --git a/core/modules/entity/lib/Drupal/entity/Entity/EntityViewMode.php b/core/modules/entity/lib/Drupal/entity/Entity/EntityViewMode.php
index 6107d4f..1d17d5e 100644
--- a/core/modules/entity/lib/Drupal/entity/Entity/EntityViewMode.php
+++ b/core/modules/entity/lib/Drupal/entity/Entity/EntityViewMode.php
@@ -50,7 +50,7 @@ use Drupal\entity\EntityViewModeInterface;
* "uuid" = "uuid"
* },
* links = {
- * "edit-form" = "admin/structure/display-modes/view/manage/{view_mode}"
+ * "edit-form" = "entity.view_mode_edit"
* }
* )
*/
diff --git a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php
index 6c4bf5b..9571584 100644
--- a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php
+++ b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php
@@ -39,7 +39,7 @@ use Drupal\filter\FilterBag;
* "status" = "status"
* },
* links = {
- * "edit-form" = "admin/config/content/formats/manage/{filter_format}"
+ * "edit-form" = "filter.format_edit"
* }
* )
*/
diff --git a/core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php b/core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php
index 414a284..3c0d729 100644
--- a/core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php
+++ b/core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php
@@ -58,7 +58,7 @@ abstract class NormalizerTestBase extends DrupalUnitTestBase {
*/
function setUp() {
parent::setUp();
- $this->installSchema('system', array('variable', 'url_alias'));
+ $this->installSchema('system', array('variable', 'url_alias', 'router'));
$this->installSchema('user', array('users'));
$this->installSchema('entity_test', array('entity_test'));
$this->installConfig(array('field', 'language'));
diff --git a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
index 1c7257a..042c0e0 100644
--- a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
+++ b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
@@ -42,7 +42,7 @@ use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
* "uuid" = "uuid"
* },
* links = {
- * "edit-form" = "admin/config/media/image-styles/manage/{image_style}"
+ * "edit-form" = "image.style_edit"
* }
* )
*/
diff --git a/core/modules/language/lib/Drupal/language/Entity/Language.php b/core/modules/language/lib/Drupal/language/Entity/Language.php
index d4c8e1b..8580d87 100644
--- a/core/modules/language/lib/Drupal/language/Entity/Language.php
+++ b/core/modules/language/lib/Drupal/language/Entity/Language.php
@@ -39,7 +39,7 @@ use Drupal\language\LanguageInterface;
* "uuid" = "uuid"
* },
* links = {
- * "edit-form" = "admin/config/regional/language/edit/{language_entity}"
+ * "edit-form" = "language.edit"
* }
* )
*/
diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module
index 5fe0aa7..519bdd9 100644
--- a/core/modules/menu/menu.module
+++ b/core/modules/menu/menu.module
@@ -111,7 +111,7 @@ function menu_menu() {
*/
function menu_entity_info(&$entity_info) {
$entity_info['menu']['controllers']['list'] = 'Drupal\menu\MenuListController';
- $entity_info['menu']['links']['edit-form'] = 'admin/structure/menu/manage/{menu}';
+ $entity_info['menu']['links']['edit-form'] = 'menu.menu_edit';
$entity_info['menu']['controllers']['form'] = array(
'add' => 'Drupal\menu\MenuFormController',
'edit' => 'Drupal\menu\MenuFormController',
diff --git a/core/modules/node/lib/Drupal/node/Entity/Node.php b/core/modules/node/lib/Drupal/node/Entity/Node.php
index d7b1f6a..f67d15b 100644
--- a/core/modules/node/lib/Drupal/node/Entity/Node.php
+++ b/core/modules/node/lib/Drupal/node/Entity/Node.php
@@ -52,9 +52,9 @@ use Drupal\node\NodeInterface;
* route_base_path = "admin/structure/types/manage/{bundle}",
* permission_granularity = "bundle",
* links = {
- * "canonical" = "/node/{node}",
- * "edit-form" = "/node/{node}/edit",
- * "version-history" = "/node/{node}/revisions"
+ * "canonical" = "node.view",
+ * "edit-form" = "node.page_edit",
+ * "version-history" = "node.revision_overview"
* }
* )
*/
diff --git a/core/modules/node/lib/Drupal/node/Entity/NodeType.php b/core/modules/node/lib/Drupal/node/Entity/NodeType.php
index fb13664..84bcc1d 100644
--- a/core/modules/node/lib/Drupal/node/Entity/NodeType.php
+++ b/core/modules/node/lib/Drupal/node/Entity/NodeType.php
@@ -38,7 +38,7 @@ use Drupal\Core\Annotation\Translation;
* "uuid" = "uuid"
* },
* links = {
- * "edit-form" = "admin/structure/types/manage/{node_type}"
+ * "edit-form" = "node.type_edit"
* }
* )
*/
diff --git a/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php b/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php
index f059079..0f056a9 100644
--- a/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php
+++ b/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php
@@ -37,7 +37,7 @@ use Drupal\picture\PictureMappingInterface;
* "uuid" = "uuid"
* },
* links = {
- * "edit-form" = "admin/config/media/picturemapping/{picture_mapping}"
+ * "edit-form" = "picture.mapping_page_edit"
* }
* )
*/
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaTestBase.php b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaTestBase.php
index 386fc54..29d4084 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaTestBase.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaTestBase.php
@@ -46,6 +46,15 @@ abstract class FieldRdfaTestBase extends FieldUnitTestBase {
public static $modules = array('rdf');
/**
+ * {@inheritdoc}
+ */
+ public function setUp() {
+ parent::setUp();
+
+ $this->installSchema('system', array('router'));
+ }
+
+ /**
* Helper function to test the formatter's RDFa.
*
* @param string $formatter
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php b/core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php
index d826f70..71a4f4d 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php
@@ -38,7 +38,7 @@ use Drupal\shortcut\ShortcutSetInterface;
* "uuid" = "uuid"
* },
* links = {
- * "edit-form" = "admin/config/user-interface/shortcut/manage/{shortcut_set}"
+ * "edit-form" = "shortcut.set_customize"
* }
* )
*/
diff --git a/core/modules/system/lib/Drupal/system/Entity/DateFormat.php b/core/modules/system/lib/Drupal/system/Entity/DateFormat.php
index d1dfca2..447f800 100644
--- a/core/modules/system/lib/Drupal/system/Entity/DateFormat.php
+++ b/core/modules/system/lib/Drupal/system/Entity/DateFormat.php
@@ -37,7 +37,7 @@ use Drupal\Core\Annotation\Translation;
* "uuid" = "uuid"
* },
* links = {
- * "edit-form" = "admin/config/regional/date-time/formats/manage/{date_format}"
+ * "edit-form" = "system.date_format_edit"
* }
* )
*/
diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php
index d776c85..5ba7091 100644
--- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php
@@ -39,8 +39,8 @@ use Drupal\Core\Language\Language;
* },
* route_base_path = "admin/structure/entity-test/manage/{bundle}",
* links = {
- * "canonical" = "/entity_test/{entity_test}",
- * "edit-form" = "/entity_test/manage/{entity_test}"
+ * "canonical" = "entity_test.render",
+ * "edit-form" = "entity_test.edit_entity_test"
* }
* )
*/
diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php
index e4e0f9c..c3f9212 100644
--- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php
@@ -38,8 +38,8 @@ use Drupal\Core\Annotation\Translation;
* },
* route_base_path = "entity_test_mul/structure/{bundle}",
* links = {
- * "canonical" = "/entity_test_mul/manage/{entity_test_mul}",
- * "edit-form" = "/entity_test_mul/manage/{entity_test_mul}"
+ * "canonical" = "entity_test.edit_entity_test_mul",
+ * "edit-form" = "entity_test.edit_entity_test_mul"
* }
* )
*/
diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php
index 25887a5..5b495f5 100644
--- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php
@@ -38,8 +38,8 @@ use Drupal\Core\Annotation\Translation;
* "bundle" = "type"
* },
* links = {
- * "canonical" = "/entity_test_mulrev/manage/{entity_test_mulrev}",
- * "edit-form" = "/entity_test_mulrev/manage/{entity_test_mulrev}"
+ * "canonical" = "entity_test.edit_entity_test_mulrev",
+ * "edit-form" = "entity_test.edit_entity_test_mulrev"
* }
* )
*/
diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php
index fb6d42c..4935645 100644
--- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php
@@ -35,8 +35,8 @@ use Drupal\Core\Annotation\Translation;
* "bundle" = "type"
* },
* links = {
- * "canonical" = "/entity_test_rev/manage/{entity_test_rev}",
- * "edit-form" = "/entity_test_rev/manage/{entity_test_rev}"
+ * "canonical" = "entity_test.edit_entity_test_rev",
+ * "edit-form" = "entity_test.edit_entity_test_rev"
* }
* )
*/
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php
index 7c9e9c3..0b7c3d6 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php
@@ -45,8 +45,8 @@ use Drupal\taxonomy\TermInterface;
* "bundle" = "vid"
* },
* links = {
- * "canonical" = "/taxonomy/term/{taxonomy_term}",
- * "edit-form" = "/taxonomy/term/{taxonomy_term}/edit"
+ * "canonical" = "taxonomy.term_page",
+ * "edit-form" = "taxonomy.term_edit"
* },
* route_base_path = "admin/structure/taxonomy/manage/{bundle}",
* permission_granularity = "bundle"
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php
index fe6669b..d89ea8f 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php
@@ -38,7 +38,7 @@ use Drupal\taxonomy\VocabularyInterface;
* "uuid" = "uuid"
* },
* links = {
- * "edit-form" = "admin/structure/taxonomy/manage/{taxonomy_vocabulary}"
+ * "edit-form" = "taxonomy.overview_terms"
* }
* )
*/
diff --git a/core/modules/user/lib/Drupal/user/Entity/Role.php b/core/modules/user/lib/Drupal/user/Entity/Role.php
index d58a358..b4e9a12 100644
--- a/core/modules/user/lib/Drupal/user/Entity/Role.php
+++ b/core/modules/user/lib/Drupal/user/Entity/Role.php
@@ -35,7 +35,7 @@ use Drupal\user\RoleInterface;
* "label" = "label"
* },
* links = {
- * "edit-form" = "admin/people/roles/manage/{user_role}"
+ * "edit-form" = "user.role_edit"
* }
* )
*/
diff --git a/core/modules/user/lib/Drupal/user/Entity/User.php b/core/modules/user/lib/Drupal/user/Entity/User.php
index 359031a..fe90bfc 100644
--- a/core/modules/user/lib/Drupal/user/Entity/User.php
+++ b/core/modules/user/lib/Drupal/user/Entity/User.php
@@ -41,8 +41,8 @@ use Drupal\user\UserInterface;
* "uuid" = "uuid"
* },
* links = {
- * "canonical" = "/user/{user}",
- * "edit-form" = "/user/{user}/edit"
+ * "canonical" = "user.view",
+ * "edit-form" = "user.edit"
* }
* )
*/
diff --git a/core/modules/views/lib/Drupal/views/Entity/View.php b/core/modules/views/lib/Drupal/views/Entity/View.php
index 1420ed8..86c9720 100644
--- a/core/modules/views/lib/Drupal/views/Entity/View.php
+++ b/core/modules/views/lib/Drupal/views/Entity/View.php
@@ -31,9 +31,6 @@ use Drupal\views\ViewExecutable;
* "label" = "label",
* "uuid" = "uuid",
* "status" = "status"
- * },
- * links = {
- * "edit-form" = "admin/structure/views/view/{view}"
* }
* )
*/
diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module
index 850f8cf..53261e1 100644
--- a/core/modules/views_ui/views_ui.module
+++ b/core/modules/views_ui/views_ui.module
@@ -56,6 +56,7 @@ function views_ui_entity_info(&$entity_info) {
'break_lock' => 'Drupal\views_ui\Form\BreakLockForm',
),
);
+ $entity_info['view']['links']['edit-form'] = 'views_ui.edit';
}
/**