composer require --dev shopro/sylius-hook-highlighter-plugin
Add this to config/bundles.php
:
<?php
return [
// ...Your other bundles
Shopro\SyliusHookHighlighterPlugin\SyliusHookHighlighterPlugin::class => ['dev' => true],
];
Create a file called config/packages/dev/hook_highlighter.yaml
:
imports:
- { resource: "@SyliusHookHighlighterPlugin/config/config.yaml" }
You’re done.
In the Sylius interface, you'll see a hook icon. This works in both admin and shop. When you click it, you'll enter 'highlight mode'. This allows you to select elements that are within hooks. If you click an element while in highlight mode, a popup will appear, giving you all the information you need to override or extend the hook.
If a hook is empty (having no hookables in it), it will show a hook icon. Clicking that will bring up a similar popup, with only the hook name.
This bundle only works in Sylius 2 or higher. Sylius 1 does not have Twig hooks.
This bundle is little more than some JS and a few Twig templates, but using it will make you much faster at extending hooks than manually perusing the HTML comments.