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

Component groups: a maximum number of components (e.g. exactly one CTA)

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

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

Từ ngày 16/10/2026.

  • #467 của @silverbackdan — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
20/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php, symfony
Lĩnh vực
backend

Hướng nghiên cứu

Start with src/Validator/Constraints/ComponentPositionValidator.php, which already checks allowed and ExplicitAllowOnly types, and the ComponentGroup entity that will hold maxComponents. Pull request #467 is already open against this issue, so read it and talk to the maintainers before writing anything. Done means a position that would exceed the limit fails validation on add and on move, and over-limit existing groups are reported rather than deleted.

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

Mô tả

A component group can restrict which components it holds (allowedComponents, ExplicitAllowOnly), but not how many. Some areas of a design hold exactly one thing: a header's single call-to-action button, a hero, a page's one form. Today an editor can add a second, and it stacks.

Example

Cymru Kitchens' header is getting a layout-level headerButton group with one HeaderButton (ExplicitAllowOnly). The designer's spec is a single CTA, because several CTAs together are bad practice. Nothing stops a second button.

Proposal

  • A maxComponents (nullable int) on ComponentGroup, next to allowedComponents.
  • Written by the front end the same way as allowedComponents: from the CwaComponentGroup prop, through the group synchronizer. Settable in fixtures and over REST.
  • Enforced on the server in ComponentPositionValidator (src/Validator/Constraints/ComponentPositionValidator.php), which already checks allowed and ExplicitAllowOnly types. A position that would exceed the limit fails validation, so no client can bypass it.
  • Exposed on the group resource, so the admin knows when the group is full.

Points to settle

  • What counts. Every position in the group, or only static positions with a component? A dynamic pageDataProperty position is a slot too. A component's draft and published versions share one position, so they must count once.
  • Moves. Moving a position into a full group is rejected the same way as adding one.
  • Existing over-limit groups. When a limit is set on a group that already holds more, nothing is deleted. Report them, e.g. as a validation notice in the admin and in the orphan or stranded-group tooling, and only block adding more.
  • Contract with the module. The same as allowedComponents: the prop value, the serialized field and the validation messages.

Front-end side: components-web-app/cwa-nuxt-module (linked below).

Ngôn ngữ chính
PHP
Star
32
Fork
8
Merge trung bình
40 phút
Pull request đã merge (30 ngày)
133

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 components-web-app/api-components-bundle

Tất cả issue của components-web-app/api-components-bundle

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.