Score:0

Creating tabbed config settings

mw flag

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

Andrew Morris avatar
mw flag
Turns out the problem was that I had `my_module.links.taskS.yml`, instead of `my_module.links.task.yml`.....
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.