Component groups: a maximum number of components (e.g. exactly one CTA)
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #467 @silverbackdan による — マージ済み
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 20/100
調査の方向性
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) onComponentGroup, next toallowedComponents. - Written by the front end the same way as
allowedComponents: from theCwaComponentGroupprop, 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 andExplicitAllowOnlytypes. 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
pageDataPropertyposition 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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
components-web-app/api-components-bundle のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
components-web-app/api-components-bundle#556 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
components-web-app/api-components-bundle#333 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
components-web-app/api-components-bundle#325 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
components-web-app/api-components-bundle#259 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
components-web-app/api-components-bundle#186 ·
メンテナーはふだん 1 日以内に返信
components-web-app/api-components-bundle の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
verbb/formie#3033 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Type] Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Awaiting Triage enhancement / feature request
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
macOS
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
beyondcode/herd-community#1774 ·