Timeline for DRY variable setting across templates (macro for variable?)
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 30, 2020 at 17:41 | answer | added | Lindsey D | timeline score: 2 | |
Jul 30, 2020 at 15:33 | comment | added | Jonathan Schofield |
Have just found Robin Schambach’s 2017 answer to Use a Twig macro to set a variable. I note that Twig perversion provides a return scope, which I think is what I need, but I’m nervous about relying on a third party plugin for this. Would be great if it were native to Craft.
|
|
Jul 30, 2020 at 15:18 | comment | added | Jonathan Schofield | Ok. Am I right that you can’t use a Macro to change the state/contents of a variable – e.g. a hash – because a Macro is predicated on generating markup? If yes, is there another technique? | |
Jul 30, 2020 at 13:55 | comment | added | Lindsey D | Not necessarily, though it would be a reasonable solution. You can probably pull this off in raw Twig as well. | |
Jul 30, 2020 at 10:59 | comment | added | Jonathan Schofield | Hi Lindsey. Not great. Is this plugin territory? | |
Jul 29, 2020 at 20:59 | comment | added | Lindsey D | How good are your PHP skills? | |
Jul 29, 2020 at 19:32 | history | asked | Jonathan Schofield | CC BY-SA 4.0 |