Skip to content

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

Open
jackmcdade wants to merge 1 commit into6.xfrom
asset-tag-filtering-conditions
Open

[6.x] Add support for filtering conditions in Assets Tag#13936
jackmcdade wants to merge 1 commit into6.xfrom
asset-tag-filtering-conditions

Conversation

@jackmcdade
Copy link
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

@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.

? $this->assetsFromCollection($collection)
: $this->assetsFromContainer($id, $path);
if ($collection) {
return $this->outputCollection($this->assetsFromCollection($collection));
Copy link

Choose a reason for hiding this comment

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

Double filterByType applied on collection path

Low Severity

When the index() method takes the collection path, filterByType is applied twice. assetsFromCollection already calls filterByType on each field's value internally. Then outputCollection calls applyPostCollectionFilters, which calls filterByType again on the entire resulting collection. While functionally idempotent for now, this is redundant and risks inconsistency if filterByType behavior ever changes.

Additional Locations (1)

Fix in Cursor Fix in Web

@jackmcdade jackmcdade marked this pull request as ready for review February 14, 2026 05:28
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.

1 participant