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..0550bde 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,7 +17,8 @@ class ContentTranslationController { /** * @todo Remove content_translation_overview(). */ - public function overview(EntityInterface $entity) { + public function overview(Request $request) { + $entity = $request->attributes->get($request->attributes->get('_entity_type')); module_load_include('pages.inc', 'content_translation'); return content_translation_overview($entity); } @@ -25,7 +26,8 @@ public function overview(EntityInterface $entity) { /** * @todo Remove content_translation_add_page(). */ - public function add(EntityInterface $entity, $source, $target) { + public function add(Request $request, $source, $target) { + $entity = $request->attributes->get($request->attributes->get('_entity_type')); module_load_include('pages.inc', 'content_translation'); $source = language_load($source); $target = language_load($target); @@ -35,7 +37,8 @@ public function add(EntityInterface $entity, $source, $target) { /** * @todo Remove content_translation_edit_page(). */ - public function edit(EntityInterface $entity, $language) { + public function edit(Request $request, $language) { + $entity = $request->attributes->get($request->attributes->get('_entity_type')); module_load_include('pages.inc', 'content_translation'); $language = language_load($language); return content_translation_edit_page($entity, $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..4ec42ba 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 @@ -6,8 +6,8 @@ namespace Drupal\content_translation\Form; -use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Language\Language; +use Symfony\Component\HttpFoundation\Request; /** * Temporary form controller for content_translation module. @@ -19,7 +19,8 @@ class ContentTranslationForm { * * @todo Remove content_translation_delete_confirm(). */ - public function deleteTranslation(EntityInterface $entity, $language) { + public function deleteTranslation(Request $request, $language) { + $entity = $request->attributes->get($request->attributes->get('_entity_type')); module_load_include('pages.inc', 'content_translation'); $language = language_load($language); return drupal_get_form('content_translation_delete_confirm', $entity, $language); 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..36b4b57 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 = '/' . str_replace($entity_info['menu_path_wildcard'], '{' . $entity_type . '}', $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,6 +80,7 @@ public function routes(RouteBuildEvent $event) { 'source' => NULL, 'target' => NULL, '_title' => 'Add', + '_entity_type' => $entity_type, ), array( @@ -101,6 +103,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 +125,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',