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

[TwigHooks][RFC] improving the DX

オープン
#167 コメント 3 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
php, symfony

調査の方向性

ファイルやテストは指定されていません。まず現在の TwigHooks 拡張の設定とリソース操作の処理を見つけ、次にその両方を提案されている fluent API および属性の例と比較してください。プロジェクトが具体的な API の範囲と実装方針について合意し、ユーザーランドのフック設定をどのように表現するかも決まれば完了です。

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

説明

feature

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分
マージ済み PR(30日)
8

環境構築

はじめの一歩

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

Sylius/Stack のほかの issue

Sylius/Stack の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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