Fred twig; dump all options to chunk or snippet

Which version of twig does Fred use and what limits are placed on twig, if any? I’ve tried a few functions which are supposed to be available in twig, but not all of them seem to be enabled. One in particular is, dump(). I thought maybe it’d help me to explore what all if available in Fred, but doesn’t seem to be an available function.

My current goal is to dump all of the options on the element to a chunk or snippet, and use them there. I have much functionality/templating and many options which are in common among all of my Fred Elements and used in a common way throughout them. Having to update each element every time I make a minor change in one of the aforementioned, is quite the chore, and I’m only going to be adding more elements.

Is there a way to effectively do this without writing them all out? Writing out all the twig variables manually will be my last resort, but it is doable–thought it would still require updating every Fred Element every time that I make a minor change.

It looks like, in combination with "remote":true, I can just use something like, [[someSnippet? &input={{ _context|json_encode() }}]], or make an modx filter snippet to extract a key from the JSON. I haven’t thought through escaping bash ticks yet.

I still want to know if anyone else has any creative ideas for working with the relative inflexibility of Fred Elements and Option Sets.

While logged into modx and using Fred, the snippet receives an empty string. However, when rendering the page without Fred (while not logged in to modx), the expected JSON is received by the snippet. Unfortunately, that’s not quite good enough, as then it makes Fred almost useless when using it this way.

I welcome any suggestions!

I revisited this, and found that passing {{ _context|json_encode }} actually was working, but that it produced an html_entities encoded string. Passing it through the, raw filter, like {{ _context|json_encode|raw }}, did the trick for the snippet.

That said, I still haven’t found a way to get a chunk to interact with twig/Fred in the way that I want.

Additionally, if you have your snippets run inside an html tag, twig seems to do some strange things to it when Fred isn’t running. Turning autoescaping off within the element template did nothing to alter this outcome. I suspect there’s a good reason. What might that reason be?