Is it possible to pass [+wf.id+] as snippet parameter inside a rowTpl?
Reason being, I need different kind of markup / CSS depending on 3 TVs. Something I couldn’t solve with phx, since I need to check more than one single variable.
Inside my custom WF rowTpl chunk, I placed my snippet like this: [[snippetName? &docid=`[+wf.id+]`]] but that didn’t work.
Is there a workaround for this? Thanks in advance for pointers.
It’s probably a problem with your snippet call, since I have working examples of the approach you have described. Perhaps try making the snippet just return ’hello’ to see if that works and go from there.
Well, a simple "hello" doesn’t cut it, this is not the first snippet I’m writing, after all. The snippet as such works, alternating cached and uncached snippetcall syntax is correct.
It’s just that I can’t seem to pass the WF id to the snippet. I can’t use [*id*] or $modx->documentIdentifier either, since that only gives me the id of the document where WF is running, not the id of each single menu element that WF is processing.
I don’t think the alternating cacheable/uncachebale snippet call rule applies here. Wayfinder will parse the wayfinder placeholders, such as [+wf.id+], and output the result. It wont parse the snippet call in your Wayfinder template; MODx will do that later. So, the snippet call in the Wayfinder template ends up as a snippet call in the document template. It can be cacheable or uncacheable as you like.
In what way doesn’t your snippet call work then? Are you saying that
outputs hello, but
doesn’t output anything?
Yes, that’s it. I assume that it’s the way the MODx parser (or WF) works.
Wayfinder traverses each document and uses chunks to render the desired output. (&rowTpl= etc.)
But if - within that rowTpl chunk - I want to insert a snippet which queries the *current* document, the doc id is not being returned at all. I don’t really know why... maybe I’ll have to analyze the WF source code o_O.