diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php index e269aa5..8f999b6 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php @@ -372,7 +372,7 @@ function testCommentFunctionality() { $data = array('bundle' => 'entity_test_render', 'name' => $random_label); $new_entity = entity_create('entity_test_render', $data); $new_entity->save(); - $this->drupalGet('entity_test_render/manage/' . $new_entity->id() . '/edit'); + $this->drupalGet('entity_test_render/manage/' . $new_entity->id()); $this->assertNoFieldChecked('edit-field-foobar-0-status-1'); $this->assertFieldChecked('edit-field-foobar-0-status-2'); $this->assertNoField('edit-field-foobar-0-status-0'); diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index 2b6a611..a3a074a 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -148,20 +148,6 @@ function content_translation_menu() { $item[str_replace('_', ' ', $key)] = $value; } - $items["$path/translations"] = array( - 'title' => 'Translate', - 'route_name' => "content_translation.translation_overview_$entity_type", - 'type' => MENU_LOCAL_TASK, - 'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE, - 'weight' => 2, - ) + $item; - - $items["$path/translations/overview"] = array( - 'title' => 'Overview', - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => 0, - ); - // Add translation callback. // @todo Add the access callback instead of replacing it as soon as the // routing system supports multiple callbacks. diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Controller/ContentTranslationController.php b/core/modules/content_translation/lib/Drupal/content_translation/Controller/ContentTranslationController.php index ec229e1..21297f5 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Controller/ContentTranslationController.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Controller/ContentTranslationController.php @@ -7,7 +7,7 @@ namespace Drupal\content_translation\Controller; -use Drupal\Core\Entity\EntityInterface; +use Symfony\Component\HttpFoundation\Request; /** * Base class for entity translation controllers. @@ -17,28 +17,28 @@ class ContentTranslationController { /** * @todo Remove content_translation_overview(). */ - public function overview(EntityInterface $entity) { + public function overview(Request $request, $entity_type) { module_load_include('pages.inc', 'content_translation'); - return content_translation_overview($entity); + return content_translation_overview($request->attributes->get($entity_type)); } /** * @todo Remove content_translation_add_page(). */ - public function add(EntityInterface $entity, $source, $target) { + public function add(Request $request, $entity_type, $source, $target) { module_load_include('pages.inc', 'content_translation'); $source = language_load($source); $target = language_load($target); - return content_translation_add_page($entity, $source, $target); + return content_translation_add_page($request->attributes->get($entity_type), $source, $target); } /** * @todo Remove content_translation_edit_page(). */ - public function edit(EntityInterface $entity, $language) { + public function edit(Request $request, $entity_type, $language) { module_load_include('pages.inc', 'content_translation'); $language = language_load($language); - return content_translation_edit_page($entity, $language); + return content_translation_edit_page($request->attributes->get($entity_type), $language); } } diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Form/ContentTranslationForm.php b/core/modules/content_translation/lib/Drupal/content_translation/Form/ContentTranslationForm.php index 7142a49..034d220 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Form/ContentTranslationForm.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Form/ContentTranslationForm.php @@ -1,4 +1,5 @@ attributes->get($entity_type), $language); } } 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 764b06a..77ba42a 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 @@ -62,7 +62,7 @@ public function getDerivativeDefinitions(array $base_plugin_definition) { // Create tabs for all possible entity types. foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) { if ($entity_info['translatable'] && isset($entity_info['translation'])) { - $path = '/' . str_replace($entity_info['menu_path_wildcard'], '{entity}', $entity_info['menu_base_path']); + $path = '/' . preg_replace('/%(.*)/', '{$1}', $entity_info['menu_base_path']); $routes = $this->routeProvider->getRoutesByPattern($path)->all(); if (empty($routes)) { continue; 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 5d30c4c..dbcbbcf 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 @@ -50,13 +50,14 @@ public function routes(RouteBuildEvent $event) { $collection = $event->getRouteCollection(); foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) { if ($entity_info['translatable'] && isset($entity_info['translation'])) { - $path = '/' . str_replace($entity_info['menu_path_wildcard'], '{entity}', $entity_info['menu_base_path']) . '/translations'; + $path = '/' . preg_replace('/%(.*)/', '{$1}', $entity_info['menu_base_path']) . '/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, @@ -79,7 +80,7 @@ public function routes(RouteBuildEvent $event) { 'source' => NULL, 'target' => NULL, '_title' => 'Add', - + 'entity_type' => $entity_type, ), array( '_permission' => 'translate any entity', @@ -101,6 +102,7 @@ public function routes(RouteBuildEvent $event) { '_content' => '\Drupal\content_translation\Controller\ContentTranslationController::edit', 'language' => NULL, '_title' => 'Edit', + 'entity_type' => $entity_type, ), array( '_permission' => 'translate any entity', @@ -122,6 +124,7 @@ public function routes(RouteBuildEvent $event) { '_content' => '\Drupal\content_translation\Form\ContentTranslationForm::deleteTranslation', 'language' => NULL, '_title' => 'Delete', + 'entity_type' => $entity_type, ), array( '_permission' => 'translate any entity',