0

I have the module.routing.yml as

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

and module.links.task.yml as

 entity.node.ssl_check:  
  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. – kiamlaluno 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. – kiamlaluno Jul 21 '16 at 6:40
2

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

#test.links.task.yml
test.node_test:
   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.

0

Modified the code as

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

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.