[TwigHooks][RFC] improving the DX
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
调研方向
没有指定文件或测试。先定位当前的 TwigHooks 扩展配置和资源操作处理逻辑,然后将二者与提议的 fluent API 和属性示例进行比较。完成的标准应是项目已经就具体的 API 范围和实现路径达成一致,包括如何表示用户态 hook 配置。
由索引模型根据 Issue 内容生成。
描述
Before
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return static function (ContainerConfigurator $container): void {
$container->extension('sylius_twig_hooks', [
'hooks' => [
'sylius_admin.book.show.content' => [
'body' => [
'template' => 'library/book/show/content/body.html.twig',
'priority' => 100,
],
'dropdown' => [
'component' => DropdownComponent::class,
'priority' => 0,
'props' => [],
],
],
],
]);
};
After
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return static function (TwigHooksConfig $config): void {
$config->withHook(
(new Hook('sylius_admin.book.show.content'))
->withHookable(
(new HookableTemplate('body', 'library/book/show/content/body.html.twig'))
->withPriority(100)
)
->withHookable(
(new HookableComponent('dropdown', DropdownComponent::class))
->withProps([])
->withPriority(0)
)
);
};
Going further on resource operation
Then we could go further and configure them on a specific resource operation.
#[AsResource(
//...
operations: [
new Show(provider: BookItemProvider::class, hooks: [
(new Hook('sylius_admin.book.show.content'))
->withHookable(
(new HookableTemplate('body', 'library/book/show/content/body.html.twig'))
->withPriority(100)
)
->withHookable(
(new HookableComponent('dropdown', DropdownComponent::class))
->withProps([])
->withPriority(0)
)
]),
],
)]
class ShowBookResource implements ResourceInterface
Note: In userland, we do not need to configure a lot of Twig hooks for our custom operations.
- 主要语言
- PHP
- 星标
- 45
- 派生
- 34
- 平均合并
- 4 天 33 分钟
- 30 天内合并 PR
- 8
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Sylius/Stack 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 84/100
-
documentation
难度 2/5 1-3 小时 新手友好度 55/100
-
feature question
难度 5/5 一周以上 新手友好度 20/100
-
feature
难度 3/5 1-2 天 新手友好度 45/100
-
documentation good first issue question
难度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
Infrastructure: actions Module: zmscitizenapi Module: zmsentities php Type: Bug unit tests
难度 2/5 1-3 小时 新手友好度 88/100
it-at-m/eappointment#3480 ·
维护者通常 1 天内回复
-
CI: composer install fails — league/flysystem 1.x blocked by security advisory GHSA-cxf4-7mrp-vvpr未关闭devops type: bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
needs approval
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 3 天内回复
-
product / avatars product / self-hosted product / storage
难度 2/5 1-3 小时 新手友好度 78/100
appwrite/appwrite#13985 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复