Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

クローズ
#464 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #467 @silverbackdan による — マージ済み

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
20/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
php, symfony
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
PHP
スター
32
フォーク
8
平均マージ
1時間
マージ済み PR(30日)
196

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

components-web-app/api-components-bundle のほかの issue

components-web-app/api-components-bundle の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。