Timeline for Pass parameter to node twig template via url
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 18, 2020 at 16:00 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Aug 9, 2019 at 7:58 | answer | added | Kate_raquel | timeline score: 1 | |
Mar 13, 2019 at 22:47 | comment | added | Marshall Morrise | Thanks @Kevin. I have defined a route "/node/{nid}/{param}". Also a controller receiving arguments $nid and $param. I can display the values received by returning #markup from the controller, so I know I'm getting them. I already had a preprocess_node hook where I can create variables for the twig template being used. What I don't know is how to make the connection between my controller and my hook. | |
Mar 13, 2019 at 17:32 | comment | added | Kevin | To do this you need to define a route and tell Drupal not only about your new route, but what that parameter is supposed to be, or if its cast to an entity. Then you would have to load that into a hook or function that creates variables for the twig template being used. | |
Mar 13, 2019 at 17:30 | history | asked | Marshall Morrise | CC BY-SA 4.0 |