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] Make limit modifier work with query builders #10818

Merged
merged 5 commits into from
Sep 18, 2024

Conversation

aerni
Copy link
Contributor

@aerni aerni commented Sep 18, 2024

I ran into a scenario in Antlers where I needed to limit the selected entries of an entries fieldtype. This PR extends the limit modifier to also support query builders.

Fieldset

handle: galleries
field:
  collections:
    - galleries
  type: entries

Content

galleries:
  - a56a6437-5a5d-4479-a6dc-38095322ba8a
  - 97e4e258-5fec-4ef3-8f54-64d855224ac1
  - bdf45d98-d6fb-471b-81b0-d11714551e24
  - 5429adf7-0a63-4e21-9163-feee07faf1f6
  - 86b1c86b-f1dc-47c1-841b-156bfca33660
limit: 3

Template

{{ galleries | limit(limit) }}

@aerni aerni changed the title Make limit modifier work with query builders [5.x] Make limit modifier work with query builders Sep 18, 2024
@aerni
Copy link
Contributor Author

aerni commented Sep 18, 2024

Thanks for simplifying the test. Learned something new today :-)

@jasonvarga jasonvarga merged commit 1caf2ad into statamic:5.x Sep 18, 2024
16 checks passed
@jasonvarga
Copy link
Member

You bet! Thanks for the PR.

@aerni aerni deleted the feature/limit-modifier branch September 18, 2024 20:27
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.

2 participants