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

Docs about stopping the Cascade

Đang mở
#1,576 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

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Tài liệu
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
php
Lĩnh vực
documentation

Hướng nghiên cứu

Read the Data Inheritance page and the linked Partial tag documentation about passing data. Check how the issue’s view:class example fits the Cascade behavior, then document the recommended approach if confirmed. Done means the docs explain how to prevent a nested partial from inheriting a parent’s class value.

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

Mô tả

Often partials use a param called class and are nested. In that case, I don't want to use the parent class data in a nested partial that doesn't receive class itself:

{{# The parent partial receives a class. #}}
{{ partial:parent class="some-class" }}
{{#
    @name Parent
    @param class Custom CSS classes.
#}}

{{# No class passed to the child. #}}
<div :$class>
    {{ partial:child }}
</div>
{{#
    @name Child
    @param class Custom CSS classes.
#}}

{{# Since class is null, the Cascade would look upwards until it finds class data. #}}
<div :$class>
    I am a child.
</div>

My solution here was to use view:class. The nested partial doesn't receive the parent's class data anymore. I don't know if this is the intended use case (besides that).

I would either add this as a "best practice" (like in the linked docs article) to the Data Inheritance docs page or another solution that might be better.

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.