Open
Description
Example:
{exp:stash:set_list name="companies"}
{stash:company}Fusionary{/stash:company}
{stash:city}Grand Rapids{/stash:city}
{stash:company}Hallmark Design{/stash:company}
{stash:city}Brighton{/stash:city}
{/exp:stash:set_list}
{exp:stash:get_list
name="companies"
output_format="json"
}
Would render:
[
{
"company": "Fusionary",
"city": "Grand Rapids"
},
{
"company": "Hallmark Design",
"city": "Brighton"
}
]
Example 2 (using same set as #1):
<div class="{exp:stash:get_list name="companies" output_format="class_attribute"}"></div>
Would render:
<div class="fusionary grand_rapids hallmark_design brighton"></div>
Example 3:
{exp:stash:set_list name="attrs"}
{stash:class}class1 otherClass{/stash:class}
{stash:id}my-id{/stash:id}
{stash:data-foo}myDataValue{/stash:data-foo}
{/exp:stash:set_list}
<div {exp:stash:get_list name="attrs" output_format="html_attributes"}></div>
Would render:
<div class="class1 otherClass" id="my-id" data-foo="myDataValue"></div>
I for one, would get endless use out of this. Much of the stash wrangling I do is for output like this.
What would be really cool, is if you modularized each "output format" or provided a hook, so that others could make output format extensions themselves!