2

This question is related to: SuperTable Returning Unexpected Results w/ Template, which is still unresolved.

In essence, Im trying to return the results of a Supertable at two different points in my template.

{% set featuredContributorsGrouped = entry.contributors
    .search('terms')
    .all()
    |group('contribution[0]')
%}

Appears in my template first, but when I try and reuse entry.contributors.all, it seems like it is already filtered by terms. This happens even if I recast entry as another temporary variable.

I was able to get around this by saving the full results as its own temporary variable before filtering it, but perhaps I'm not understanding how Craft queries modify entry information. I would assume it would be non destructive?

1

This is a change in behaviour from Craft 2 to Craft 3 and here is the explanation.

In short, you need to clone your query (docs) - see this post for more info.

1

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.