Skip to content

[6.x] Add support for filtering conditions in Assets Tag#13936

Merged
jasonvarga merged 13 commits into6.xfrom
asset-tag-filtering-conditions
Apr 8, 2026
Merged

[6.x] Add support for filtering conditions in Assets Tag#13936
jasonvarga merged 13 commits into6.xfrom
asset-tag-filtering-conditions

Conversation

@jackmcdade
Copy link
Copy Markdown
Member

@jackmcdade jackmcdade commented Feb 14, 2026

References statamic/ideas#1003


Note

Medium Risk
Changes the assets tag’s core retrieval path from in-memory collection filtering to database/query-builder constraints, which may affect result ordering/edge cases and pagination behavior; covered by new tests but touches widely used template tag behavior.

Overview
The assets tag now queries containers via an asset query builder (instead of fetching then filtering), enabling field:condition filtering, query_scope, and query-level sorting/pagination/chunking via the shared tag concerns.

Legacy params (folder/recursive, type, not_in, sort, limit/offset) are preserved by applying them as query constraints where possible and as post-processing filters for collections/paginators/chunks. Adds a focused AssetsTest suite covering condition filtering (including localized fields), scopes, pagination output shape, and legacy behavior.

Written by Cursor Bugbot for commit 6d4a4fb. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@jackmcdade jackmcdade marked this pull request as ready for review February 14, 2026 05:28
jasonvarga and others added 12 commits April 3, 2026 16:50
The asset query builder already resolves custom fields by their plain
name, so the multi-field OR logic across data->{field} and
data->{site}->{field} was unnecessary. Assets are not localizable,
so the localized field test was also updated to reflect actual usage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Instead of filtering by type after the query (which broke limit/paginate
combinations), query against the extension field directly using whereIn.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Limit/offset are applied at the query level when there is no not_in
param, and on the collection after filtering when not_in is present.
Removed GetsQueryResults and OutputsItems traits since pagination
and chunking are not needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s compatibility

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jasonvarga jasonvarga merged commit 3ac91f0 into 6.x Apr 8, 2026
17 checks passed
@jasonvarga jasonvarga deleted the asset-tag-filtering-conditions branch April 8, 2026 23:14
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