I'm using Drupal-8.0.1. And I have been developing one custom module. In that module, I have created a custom form that to be shown in the path admin/config/people/ban/settings.

By default when we enable Ban module we will found IP address ban menu link under admin/config/ path, when we click on the IP address ban link it goes to admin/config/people/ban.

I want to create a menu tab inside the admin/config/people/ban as Default and Settings.

In Default Menu tab I want to show the default content in the path admin/config/people/ban on the other side Settings menu tab I want to show my custom module form.

How can I do this in my module?


For this you need to create a route in the module.routing.yml file

  path: 'admin/config/people/ban/settings'
    _form: '\Drupal\modulename\Form\FormController'
    -title: Form Title
    _permission: 'your permission string'

then you need to create another yml file with the name mymodule.links.menu.yml

add the following code

  title: Configure Form Title
  description: 'Configuration Form description'
  parent: system.admin_config_people
  route_name: route_name //defined above

You need to check system module yml file for parent name


You need a local tasks menu link yml file, see example in node module

  • This is my module.links.menu.yml file – user15837 Jan 18 '16 at 12:59
  • Can you provide a working example? – Scott Joudry Jan 18 '16 at 13:23

The trick is that always need at least two local tasks for local tasks to show up. They don't do if there's only one.

So, define a yourmodule.menu.task.yml and put two definitions in there. Default, which has the existing ban route for both base_route and route_name and yours, which has your route_name and the same base_route as the the default task.

What used to be the default task in Drupal 7 is now simply the task that has base_route == route_name.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.