Adding a new menu item to admin/config page of Drupal 8
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 https://www.drupal.org/docs/8/api/configuration-api/working-with-config….
So from that example:
example.routing.yml is looks like below ("example" is the module name).
example.settings:
path: '/admin/structure/example/settings'
defaults:
_form: '\Drupal\example\Form\exampleSettingsForm'
_title: 'example'
requirements:
_permission: 'administer site configuration'
Now add another file called example.links.menu.yml ("example" is the module name).
example.settings:
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.