Component groups: a maximum number of components (e.g. exactly one CTA)
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #467 来自 @silverbackdan —— 已合并
评估
调研方向
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
- 平均合并
- 56 分钟
- 30 天内合并 PR
- 164
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
components-web-app/api-components-bundle 的其他 Issue
-
难度 5/5 一周以上 新手友好度 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
-
frontend good first issue healthcare-review
难度 2/5 1-3 小时 新手友好度 83/100
AfyaLinkAfrica/afyalink-web#25 ·
维护者通常 1 天内回复
-
priority:medium type:chore
难度 1/5 1-3 小时 新手友好度 84/100
crazy-goat/php-fpm-ng#1041 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
backdrop-contrib/paragraphs#299 ·
-
bug elixir P2 php test-only
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复