Adding a new menu item to admin/config page of Drupal 8

You, DrupalDrupal config

This is fairly straight forward and there is no any special thing to do compared to traditional menu items. So here is how you do it.

First you need a routing defined. Here is a great example of how you add a routing to your config form….

So from that example: 

example.routing.yml is looks like below ("example" is the module name).

  path: '/admin/structure/example/settings'
    _form: '\Drupal\example\Form\exampleSettingsForm'
    _title: 'example'
    _permission: 'administer site configuration'

Now add another file called ("example" is the module name).

  title: 'My Title'
  parent: system.admin_config_services
  route_name: 'example.settings'

Parent is important here:

For "Web Services":

parent: system.admin_config_services

For "Regional And Language":

parent: system.admin_config_regional

Other possible values for Parent:

parent: system.admin_config_media
parent: system.admin_config_development
parent: system.admin_config_search
parent: system.admin_config_system
parent: system.admin_config_ui
parent: system.admin_config_content
© Heshan Wanigasooriya.RSS

🍪 This site does not track you.