Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Add where_in modifier #10529

Merged
merged 3 commits into from
Jul 31, 2024
Merged

Conversation

andjsch
Copy link
Sponsor Contributor

@andjsch andjsch commented Jul 30, 2024

This PR adds a where_in modifier that can come in handy in various situations where you want to check a value against an array.

games:
  -
    feeling: love
    title: Dominion
  -
    feeling: happy
    title: Netrunner
  -
    feeling: hate
    title: Chutes and Ladders
<h2>I love...</h2>
{{ games | where_in('feeling', ['love', 'happy']) }}
  {{ title }}<br>
{{ /games }}
Dominion
Netrunner

@ryanmitchell
Copy link
Contributor

Is this doing the same this as #9491 ?

@andjsch
Copy link
Sponsor Contributor Author

andjsch commented Jul 30, 2024

Is this doing the same this as #9491 ?

As far as I can tell from your PR, it is not. Yours is for checking if a value is there. Mine is for filtering - it will actually return data instead of a boolean.

@jasonvarga jasonvarga merged commit c907c55 into statamic:5.x Jul 31, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants