0

I'm trying to create a tabbed configuration page for my custom module, although I can't see a lot of information on exactly what is supposed to be done.

I've seen this page but it's not exactly in depth

I've got my pages listed in my my_module.routing.yml file

my_module.api_form:
  path: /admin/config/system/my-api
  defaults:
    _title: 'Configuration'
    _form: \Drupal\MY_MODULE\Form\APIConfigurationForm
  requirements:
    _permission: 'administer site configuration'

my_module.settings_form:
  path: /admin/config/system/my-settings
  defaults:
    _title: 'Settings'
    _form: \Drupal\MY_MODULE\Form\SettingsForm
  requirements:
    _permission: 'administer site configuration'

Both of these work if I go to the page manually, but I'd like to make the api page the default one, with the settings form available as a tab. That link suggests adding a my_module.links.tasks.yml

my_module.api:
  title: 'Configuration'
  route_name: my_module.api_form
  base_route: my_module.api_form
  description: 'Configure API'
  parent: system.admin_config_system

my_module.settings:
  title: 'Settings'
  route_name: my_module.settings_form
  base_route: my_module.api_form
  description: 'Configure Settings'

I'm not sure if they also need to be as part of the my_module.links.menu.yml file as well, so they're in there too

my_module.api_form:
  title: 'Configuration'
  route_name: my_module.api_form
  description: 'Configure API'
  parent: system.admin_config_system

my_module.settings_form:
  title: 'Settings'
  route_name: my_module.settings_form
  description: 'Configure Settings'
  parent: system.admin_config_system

Both pages seem to work and do their job, but they aren't available as tabs from each other

1
  • Turns out the problem was that I had my_module.links.taskS.yml, instead of my_module.links.task.yml..... Jan 14 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.