Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Document how conditions treat empty and null values

Đang mở
#2,000 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@joshdaugherty đang làm issue này rồi.

Từ ngày 30/9/2026.

  • #2001 của @joshdaugherty — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
25/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
documentation

Hướng nghiên cứu

The change belongs on the conditions page of the docs, under the 'Using a variable reference' section. To confirm the behaviour, read Statamic\Tags\Concerns\QueriesConditions::queryableConditionParams() in statamic/cms, which skips parameters whose value is an empty string but passes null through. Done means the note is in the docs, but PR #2001 is already open with this wording, so check that PR before writing anything new.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

The conditions page doesn't say what a condition does when its value is empty or null. Two different things happen, depending on how the value is passed. Both are easy to hit when the value comes from something that can be blank, such as a query-string value, an optional field or an empty picker.

Measured on statamic/cms v6.26.0, with the collection tag on a collection of 75 published entries:

Template Value the tag receives Result
type:is="", or type:is="{{ get:type }}" when type is absent from the query string '' The condition is skipped: all 75 entries are returned
:type:is="some_var" when some_var is null or not set null Filters to entries where type is null, so only entries without that field are returned
:type:is="some_var" when some_var is '' '' The condition is skipped, as in the first row

The skip comes from Statamic\Tags\Concerns\QueriesConditions::queryableConditionParams(), which rejects any parameter whose value is ''. A null is not rejected, so it reaches $query->where($field, null).

Both behaviors seem reasonable. What's missing is a note saying so, because the two forms look interchangeable and do opposite things when the value is blank. The first lists everything; the second can list nothing, for example on blueprint, which every entry has.

Suggested wording, under Using a variable reference:

If a condition's value is an empty string, the condition is skipped and the results are not filtered by it. If a variable reference (:field:is="variable") resolves to null, the condition filters for entries where that field is empty.

Docs PR with that wording: #2001.

Ngôn ngữ chính
PHP
Star
133
Fork
405
Merge trung bình
21 giờ 45 phút
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của statamic/docs

Tất cả issue của statamic/docs

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.