croxton / Stash

Stash allows you to stash text and snippets of code for reuse throughout your templates.
GNU General Public License v3.0
197 stars 20 forks source link

Stashing a playa field entries matrix #153

Closed Third-Hyperion closed 7 years ago

Third-Hyperion commented 7 years ago

Is there a way to stash a playa field where there is a matrix field within the entry? Then get it further down, within the same channel entry tags?

{exp:channel:entries}
{playa_field}
    {matrix_field}
        {matrix_value} <-- Somehow stash this value
    {/matrix_field}
{/playa_field}
{/exp:channel:entries}

I've tried everything but I just can't figure it out. Thank you,

croxton commented 7 years ago

This can only work if there is only one entry, one playa relationship and one matrix field row. In other words, there is only one instance of {matrix_value}:

{exp:channel:entries limit="1"}

    {playa_field limit="1"}
        {matrix_field limit="1"}
            {exp:stash:set name="my_var"}{matrix_value}{/exp:stash:set}
        {/matrix_field}
    {/playa_field}

    {exp:stash:get name="my_var" process="end"}

{/exp:channel:entries}
Third-Hyperion commented 7 years ago

That's great. I only have one row also. Thanks.

On 9 February 2017 at 18:53, Mark Croxton notifications@github.com wrote:

This can only work if there is only one entry, one playa relationship and one matrix field row. In other words, there is only one instance of {matrix_value}:

{exp:channel:entries limit="1"}

{playa_field limit="1"} {matrix_field limit="1"} {exp:stash:set name="my_var"}{matrix_value}{/exp:stash:set} {/matrix_field} {/playa_field}

{exp:stash:get name="my_var" process="end"}

{/exp:channel:entries}

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/croxton/Stash/issues/153#issuecomment-278736951, or mute the thread https://github.com/notifications/unsubscribe-auth/AFVG2qOVq7AHLM93BCFCf6vRLIDF57Pyks5ra2DHgaJpZM4L8L8C .