diff --git a/lib/Drupal/config_translation/ConfigEntityMapper.php b/lib/Drupal/config_translation/ConfigEntityMapper.php index dea4d3d..1f5d431 100644 --- a/lib/Drupal/config_translation/ConfigEntityMapper.php +++ b/lib/Drupal/config_translation/ConfigEntityMapper.php @@ -101,7 +101,7 @@ class ConfigEntityMapper implements ConfigMapperInterface { $this->config_prefix = $config_prefix; $this->menu_type = $menu_type; $this->add_edit_tab = $add_edit_tab; - $this->router_name = 'config_translation_item' . $path_id_index . $entity_type; + $this->setRouteName(); } /** @@ -163,9 +163,23 @@ class ConfigEntityMapper implements ConfigMapperInterface { return new ConfigGroupMapper($base_path, $title, $names, $this->menu_type, $this->add_edit_tab); } + /** + * {@inheritdoc} + */ + public function setRouteName() { + $this->router_name = 'config_translation.item.' . str_replace(array('/', '-'), array('.', '_'), $this->base_path); + } + + /** + * {@inheritdoc} + */ public function getRouterName() { return $this->router_name; } + + /** + * {@inheritdoc} + */ public function getType() { return $this->entity_type; } diff --git a/lib/Drupal/config_translation/ConfigGroupMapper.php b/lib/Drupal/config_translation/ConfigGroupMapper.php index dffaace..4c305c0 100644 --- a/lib/Drupal/config_translation/ConfigGroupMapper.php +++ b/lib/Drupal/config_translation/ConfigGroupMapper.php @@ -78,7 +78,7 @@ class ConfigGroupMapper implements ConfigMapperInterface { $this->names = $names; $this->menu_type = $menu_type; $this->add_edit_tab = $add_edit_tab; - $this->router_name = 'config_translation_item'; + $this->setRouteName(); } /** @@ -221,10 +221,23 @@ class ConfigGroupMapper implements ConfigMapperInterface { $this->names[] = $name; } + /** + * {@inheritdoc} + */ + public function setRouteName() { + $this->router_name = 'config_translation.item.' . str_replace(array('/', '-'), array('.', '_'), $this->base_path); + } + + /** + * {@inheritdoc} + */ public function getRouterName() { return $this->router_name; } + /** + * {@inheritdoc} + */ public function getType() { return NULL; } diff --git a/lib/Drupal/config_translation/ConfigMapperInterface.php b/lib/Drupal/config_translation/ConfigMapperInterface.php index ef5ec55..1ba60b3 100644 --- a/lib/Drupal/config_translation/ConfigMapperInterface.php +++ b/lib/Drupal/config_translation/ConfigMapperInterface.php @@ -52,5 +52,25 @@ interface ConfigMapperInterface { */ public function getConfigGroup($arg = NULL); + /** + * Helper to provide type of the group. + * + * @return mixed + */ public function getType(); + + /** + * Creates unique route name for the group. + * + * @return mixed + */ + public function setRouteName(); + + /** + * Returns group name. + * + * @return mixed + */ + public function getRouterName(); + } diff --git a/lib/Drupal/config_translation/ConfigTranslationBundle.php b/lib/Drupal/config_translation/ConfigTranslationBundle.php index 2c789f4..0dac459 100644 --- a/lib/Drupal/config_translation/ConfigTranslationBundle.php +++ b/lib/Drupal/config_translation/ConfigTranslationBundle.php @@ -16,10 +16,10 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; class ConfigTranslationBundle extends Bundle { /** - * @inheritdoc + * {@inheritdoc} */ public function build(ContainerBuilder $container) { - $container->register('config_translation.subscriber', 'Drupal\config_translation\ConfigTranslationSubscriber') + $container->register('config_translation.subscriber', 'Drupal\config_translation\Routing\RouteSubscriber') ->addTag('event_subscriber'); $container->register('config_translation.access_check', 'Drupal\config_translation\Access\ConfigNameCheck') diff --git a/lib/Drupal/config_translation/Controller/ConfigTranslationController.php b/lib/Drupal/config_translation/Controller/ConfigTranslationController.php index 155414e..e7e1b69 100644 --- a/lib/Drupal/config_translation/Controller/ConfigTranslationController.php +++ b/lib/Drupal/config_translation/Controller/ConfigTranslationController.php @@ -21,7 +21,7 @@ use Drupal\config_translation\Form\ConfigTranslationManageForm; class ConfigTranslationController implements ControllerInterface { /** - * @inheritdoc + * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static($container->get('database'));