We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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; use function Sylius\TwigHooks\Loader\Configurator\component_hook; use function Sylius\TwigHooks\Loader\Configurator\template_hook; return static function (TwigHooksConfig $config): void { $config->withHookable( (new Hookable('sylius_admin.book.show.content')) ->withHook( (new TemplateHook('body', 'library/book/show/content/body.html.twig')) ->withPriority(100) ) ->withHook( (new ComponentHook('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 Hookable('sylius_admin.book.show.content')) ->withHook( (new TemplateHook('body', 'library/book/show/content/body.html.twig')) ->withPriority(100) ) ->withHook( (new ComponentHook('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.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Before
After
Going further on resource operation
Then we could go further and configure them on a specific resource operation.
Note: In userland, we do not need to configure a lot of Twig hooks for our custom operations.
The text was updated successfully, but these errors were encountered: