diff --git a/core/modules/config_translation/src/ConfigEntityMapper.php b/core/modules/config_translation/src/ConfigEntityMapper.php index 2ae3095933..0f16c624ce 100644 --- a/core/modules/config_translation/src/ConfigEntityMapper.php +++ b/core/modules/config_translation/src/ConfigEntityMapper.php @@ -169,6 +169,25 @@ public function getBaseRouteParameters() { } /** + * {@inheritdoc} + */ + public function getBaseEditRouteName() { + return $this->entityManager->getDefinition($this->entityType)->getLinkTemplate('edit-form'); + } + + /** + * {@inheritdoc} + */ + public function getBaseEditRoute() { + if ($this->routeCollection) { + return $this->routeCollection->get($this->getBaseEditRouteName()); + } + else { + return $this->routeProvider->getRouteByName($this->getBaseEditRouteName()); + } + } + + /** * Set entity type for this mapper. * * This should be set in initialization. A mapper that knows its type but diff --git a/core/modules/config_translation/src/ConfigMapperInterface.php b/core/modules/config_translation/src/ConfigMapperInterface.php index 57c1ccd27d..55a4acef93 100644 --- a/core/modules/config_translation/src/ConfigMapperInterface.php +++ b/core/modules/config_translation/src/ConfigMapperInterface.php @@ -59,6 +59,29 @@ public function getBaseRoute(); public function getBasePath(); /** + * Returns route name for the base configuration edit form route. + * + * @return string + * Route name for the mapper. + */ + public function getBaseEditRouteName(); + + /** + * Returns the route parameters for the base configuration edit form route. + * + * @return array + */ + public function getBaseEditRouteParameters(); + + /** + * Returns the route object for the base configuration 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 @@ -113,7 +136,7 @@ public function getAddRouteParameters(); public function getAddRoute(); /** - * Returns route name for the translation edit form route. + * Returns route name for the translation edit route. * * @return string * Route name for the mapper. @@ -121,14 +144,14 @@ public function getAddRoute(); public function getEditRouteName(); /** - * Returns the route parameters for the translation edit form route. + * Returns the route parameters for the translation edit route. * * @return array */ public function getEditRouteParameters(); /** - * Returns the route object for a translation edit form route. + * Returns the route object for the translation edit 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 03716e9725..c3041b6fd6 100644 --- a/core/modules/config_translation/src/ConfigNamesMapper.php +++ b/core/modules/config_translation/src/ConfigNamesMapper.php @@ -196,6 +196,27 @@ public function getBaseRoute() { } /** + * {@inheritdoc} + */ + public function getBaseEditRouteName() { + return $this->getBaseRouteName(); + } + + /** + * {@inheritdoc} + */ + public function getBaseEditRouteParameters() { + return $this->getBaseRouteParameters(); + } + + /** + * {@inheritdoc} + */ + public function getBaseEditRoute() { + return $this->getBaseRoute(); + } + + /** * Allows to process all config translation routes. * * @param \Symfony\Component\Routing\Route $route diff --git a/core/modules/config_translation/src/Controller/ConfigTranslationController.php b/core/modules/config_translation/src/Controller/ConfigTranslationController.php index 8d9bfe7bde..41cabb6579 100644 --- a/core/modules/config_translation/src/Controller/ConfigTranslationController.php +++ b/core/modules/config_translation/src/Controller/ConfigTranslationController.php @@ -202,14 +202,14 @@ public function itemPage(Request $request, RouteMatchInterface $route_match, $pl // Check access for the path/route for editing, so we can decide to // include a link to edit or not. - $edit_access = $this->accessManager->checkNamedRoute($mapper->getBaseRouteName(), $route_match->getRawParameters()->all(), $this->account); + $edit_access = $this->accessManager->checkNamedRoute($mapper->getBaseEditRouteName(), $route_match->getRawParameters()->all(), $this->account); // Build list of operations. $operations = []; if ($edit_access) { $operations['edit'] = [ 'title' => $this->t('Edit'), - 'url' => Url::fromRoute($mapper->getBaseRouteName(), $mapper->getBaseRouteParameters(), ['query' => ['destination' => $mapper->getOverviewPath()]]), + 'url' => Url::fromRoute($mapper->getBaseEditRouteName(), $mapper->getBaseRouteParameters(), ['query' => ['destination' => $mapper->getOverviewPath()]]), ]; } }