I have the module.routing.yml as

  path: '/node/{node}/check-ssl'  
  _form: '\Drupal\ssl_check\Form\SslCheck'  
  _title: 'Check SSL Cert'  
  _permission: 'access check ssl tab'  

and module.links.task.yml as

  route_name: entity.node.ssl_check  
  title: 'Ssl check'  
  base_route: entity.node.canonical  
  weight: 15  

Here when I access node/1104/check-ssl/ the form defined in the form controller is loading. But my other need that is to show a 'Ssl check' tab when I visit path /node/1104/ is not there. I have done the tab thing while dealing with Controller but not working with form controller. Please help. I have checked 'Add tab / local task to a node' this but there was nothing dealing with form controller.

  • The module.routing.yml file you are showing is not well-formed; it misses the indentation for defaults. – apaderno Jul 21 '16 at 6:17
  • Also, as for creating local tasks, there isn't any difference between using a form or a controller: What you put in the .links.task.yml file is the same for both the cases. – apaderno Jul 21 '16 at 6:40

Since everything looked just fine in your code, I tried the following in a custom module:

   title: 'Wooorking'
   route_name: entity.node.canonical
   base_route: entity.node.canonical

And this is working like a charm. Also when I added a custom routing, which was pointing to a form controller, it showed up! (although not worked, because I didn't handled the node parameter in the routing configuration)

So the problem lies another where.

So I suggest you to do it step by step way (building your routing and task yml) to understand your problem. Clearing the cache each time when you change something in your YML files. If you found the problem, please post the solution, so also we can learn from this.


Modified the code as

      title: Ssl check  
      route_name: entity.node.ssl_check  
      base_route: entity.node.canonical  
      weight: 15  

I had copied and pasted my code wrong. Things to check:

  • The file name is YOUR_MODULE.links.task.yml
  • The task name is YOUR_MODULE.some_task
  • The route name is YOUR_MODULE.some_route

The last one got me. It appears that if the route does not exist, the local task will silently not show.

File: YOUR_MODULE.links.task.yml

  title: 'Example Title'  
  route_name: YOUR_MODULE.manual_email
  base_route: YOUR_MODULE.manual_email

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.