1

I am using stash to store some common site data and would like to use a grid field to store one of the fields with the user having the option to input 0-4 rows. Is there a way to do this with stash?

So if I was stashing the variables is there anything I use like the switch statement with stash?

Something like:

{grid_field}
    {exp:stash:row_{switch='1|2|3|4'}_col_1}{grid_field:col_1}{/exp:stash:row_{switch='1|2|3|4'}_col_1}
    {exp:stash:row_{switch='1|2|3|4'}_col_2}{grid_field:col_2}{/exp:stash:row_{switch='1|2|3|4'}_col_2}
{/grid_field}
1

WOW! I'm an idiot. lol

I read right past the lists in the docs. Thanks for a great add on and doc set Mark. ;)

https://github.com/croxton/Stash/wiki/Lists

{exp:stash:set_list name="mini_links" parse_tags="yes"}
    {mini_links}
        {stash:href}{mini_links:link}{/stash:href}
        {stash:text}{mini_links:title}{/stash:text}
    {/mini_links}
{/exp:stash:set_list}

Then:

<nav id="sub-menu">
    <ul>
        {exp:stash:get_list name="mini_links"}
            <li><a href="{href}">{text}</a></li>
        {/exp:stash:get_list}
    </ul>
</nav>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.