diff --git a/core/modules/config_translation/src/ConfigEntityMapper.php b/core/modules/config_translation/src/ConfigEntityMapper.php index 3b748a7..7531b66 100644 --- a/core/modules/config_translation/src/ConfigEntityMapper.php +++ b/core/modules/config_translation/src/ConfigEntityMapper.php @@ -165,19 +165,19 @@ public function getBaseRouteParameters() { /** * {@inheritdoc} */ - public function getEditRouteName() { + public function getBaseEditRouteName() { return $this->entityManager->getDefinition($this->entityType)->getLinkTemplate('edit-form'); } /** * {@inheritdoc} */ - public function getEditRoute() { + public function getBaseEditRoute() { if ($this->routeCollection) { - return $this->routeCollection->get($this->getEditRouteName()); + return $this->routeCollection->get($this->getBaseEditRouteName()); } else { - return $this->routeProvider->getRouteByName($this->getEditRouteName()); + return $this->routeProvider->getRouteByName($this->getBaseEditRouteName()); } } diff --git a/core/modules/config_translation/src/ConfigMapperInterface.php b/core/modules/config_translation/src/ConfigMapperInterface.php index d7e1d37..bf28cd1 100644 --- a/core/modules/config_translation/src/ConfigMapperInterface.php +++ b/core/modules/config_translation/src/ConfigMapperInterface.php @@ -64,6 +64,29 @@ public function getBaseRoute(); public function getBasePath(); /** + * Returns route name for the edit route. + * + * @return string + * Route name for the mapper. + */ + public function getBaseEditRouteName(); + + /** + * Returns the route parameters for the edit form route. + * + * @return array + */ + public function getBaseEditRouteParameters(); + + /** + * Returns the route object for the edit form route. + * + * @return \Symfony\Component\Routing\Route + * The route object for the translation page. + */ + public function getBaseEditRoute(); + + /** * Returns route name for the translation overview route. * * @return string @@ -123,40 +146,17 @@ public function getAddRoute(); * @return string * Route name for the mapper. */ - public function getTranslateRouteName(); - - /** - * Returns the route parameters for the translation route. - * - * @return array - */ - public function getTranslateRouteParameters(); - - /** - * Returns the route object for the translation route. - * - * @return \Symfony\Component\Routing\Route - * The route object for the translation page. - */ - public function getTranslateRoute(); - - /** - * Returns route name for the edit route. - * - * @return string - * Route name for the mapper. - */ public function getEditRouteName(); /** - * Returns the route parameters for the edit form route. + * Returns the route parameters for the translation route. * * @return array */ public function getEditRouteParameters(); /** - * Returns the route object for the edit form route. + * Returns the route object for the translation route. * * @return \Symfony\Component\Routing\Route * The route object for the translation page. diff --git a/core/modules/config_translation/src/ConfigNamesMapper.php b/core/modules/config_translation/src/ConfigNamesMapper.php index e8c7d84..8b95e5c 100644 --- a/core/modules/config_translation/src/ConfigNamesMapper.php +++ b/core/modules/config_translation/src/ConfigNamesMapper.php @@ -191,21 +191,21 @@ public function getBaseRoute() { /** * {@inheritdoc} */ - public function getEditRouteName() { + public function getBaseEditRouteName() { return $this->getBaseRouteName(); } /** * {@inheritdoc} */ - public function getEditRouteParameters() { + public function getBaseEditRouteParameters() { return $this->getBaseRouteParameters(); } /** * {@inheritdoc} */ - public function getEditRoute() { + public function getBaseEditRoute() { return $this->getBaseRoute(); } @@ -299,21 +299,21 @@ public function getAddRoute() { /** * {@inheritdoc} */ - public function getTranslateRouteName() { + public function getEditRouteName() { return 'config_translation.item.edit.' . $this->getBaseRouteName(); } /** * {@inheritdoc} */ - public function getTranslateRouteParameters() { + public function getEditRouteParameters() { return $this->getAddRouteParameters(); } /** * {@inheritdoc} */ - public function getTranslateRoute() { + public function getEditRoute() { $route = new Route( $this->getBaseRoute()->getPath() . '/translate/{langcode}/edit', array( diff --git a/core/modules/config_translation/src/Controller/ConfigTranslationController.php b/core/modules/config_translation/src/Controller/ConfigTranslationController.php index cf7c5ec..c9eb31f 100644 --- a/core/modules/config_translation/src/Controller/ConfigTranslationController.php +++ b/core/modules/config_translation/src/Controller/ConfigTranslationController.php @@ -175,7 +175,7 @@ public function itemPage(Request $request, RouteMatchInterface $route_match, $pl if ($edit_access) { $operations['edit'] = array( 'title' => $this->t('Edit'), - 'url' => Url::fromRoute($mapper->getEditRouteName(), $mapper->getEditRouteParameters(), ['query' => ['destination' => $mapper->getOverviewPath()]]), + 'url' => Url::fromRoute($mapper->getBaseEditRouteName(), $mapper->getBaseEditRouteParameters(), ['query' => ['destination' => $mapper->getOverviewPath()]]), ); } } @@ -194,7 +194,7 @@ public function itemPage(Request $request, RouteMatchInterface $route_match, $pl // Otherwise, link to edit the existing translation. $operations['edit'] = array( 'title' => $this->t('Edit'), - 'url' => Url::fromRoute($mapper->getTranslateRouteName(), $mapper->getTranslateRouteParameters()), + 'url' => Url::fromRoute($mapper->getEditRouteName(), $mapper->getEditRouteParameters()), ); $operations['delete'] = array( diff --git a/core/modules/config_translation/src/Routing/RouteSubscriber.php b/core/modules/config_translation/src/Routing/RouteSubscriber.php index 981e778..d9d56ad 100644 --- a/core/modules/config_translation/src/Routing/RouteSubscriber.php +++ b/core/modules/config_translation/src/Routing/RouteSubscriber.php @@ -43,7 +43,7 @@ protected function alterRoutes(RouteCollection $collection) { foreach ($mappers as $mapper) { $collection->add($mapper->getOverviewRouteName(), $mapper->getOverviewRoute()); $collection->add($mapper->getAddRouteName(), $mapper->getAddRoute()); - $collection->add($mapper->getTranslateRouteName(), $mapper->getTranslateRoute()); + $collection->add($mapper->getEditRouteName(), $mapper->getEditRoute()); $collection->add($mapper->getDeleteRouteName(), $mapper->getDeleteRoute()); } } diff --git a/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php b/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php index 7c8c633..50e2712 100644 --- a/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php +++ b/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php @@ -259,7 +259,7 @@ public function testGetAddRoute() { * Tests ConfigNamesMapper::getEditRouteName(). */ public function testGetEditRouteName() { - $result = $this->configNamesMapper->getTranslateRouteName(); + $result = $this->configNamesMapper->getEditRouteName(); $expected = 'config_translation.item.edit.' . $this->pluginDefinition['base_route_name']; $this->assertSame($expected, $result); } @@ -273,7 +273,7 @@ public function testGetEditRouteParameters() { $this->configNamesMapper->populateFromRequest($request); $expected = array('langcode' => 'xx'); - $result = $this->configNamesMapper->getTranslateRouteParameters(); + $result = $this->configNamesMapper->getEditRouteParameters(); $this->assertSame($expected, $result); } @@ -290,7 +290,7 @@ public function testGetEditRoute() { '_config_translation_form_access' => 'TRUE', ) ); - $result = $this->configNamesMapper->getTranslateRoute(); + $result = $this->configNamesMapper->getEditRoute(); $this->assertSame(serialize($expected), serialize($result)); }