I'm trying to setup a custom module that provide content from an API.The API url is configurable, but as it is different for each language I must be able to translate it. I setup my module configuration as described here (see the gist below) but when I try to access the translation form from /admin/config/regional/config-translation, i get "Access denied"
What am I doing wrong ?
https://gist.github.com/julien-maitan/ffd136bc104d3dbe2ee526367ffcb44c
First of all,
Does your custom permission configure crtib configurator
is defined in a permissions.yml
file ? And did you give this permission to your user ?
Where is your config/install settings file ? In your case your crtib_configurator.settings.yml
? Did you miss it ?
These files are not mandatory by default in Drupal 8, but are required once we want to make your configuration translatable.
I would suggest you this 2 articles:
Update - With Review of Google Drive Files
config
folder should be placed in the root of your module not in src
;crtib_configurator.links.task.yml
use a wrong route_name crtib_configurator.api_settings_translate
, it should be crtib_configurator.api_settings
.Apply those 2 changes & clear your cache, you will then be able to use the translations form properly.
I think the main & initial error was the config
folder location.
Directory structure:
.
+-- crtib_configurator
| +-- config
| | +-- install
| | | +-- crtib_configurator.api.yml
| | +-- schema
| | | +-- crtib_configurator.schema.yml
| +-- src
| | +-- Form
| | | +-- SettingsForm.php
| +-- crtib_configurator.config_translation.yml
| +-- crtib_configurator.info.yml
| +-- crtib_configurator.links.menu.yml
| +-- crtib_configurator.links.task.yml
| +-- crtib_configurator.permissions.yml
| +-- crtib_configurator.routing.yml
Content of crtib_configurator.links.task.yml
:
crtib_configurator.api_settings:
route_name: crtib_configurator.api_settings
title: 'CRTIB configurator settings'
base_route: crtib_configurator.api_settings