Description
In this episode, you’ll learn how to use Sylius resource controllers directly inside Twig templates to build dynamic frontend components with zero additional PHP code.
Through the real-world example of a “Branded products” dropdown menu, you’ll discover how to:
- Extend the BrandRepository to expose only enabled brands via getEnabled(),
- Build a partial template brand/_brands.html.twig to render the brand list,
- Configure the sylius_shop_partial_branded_products_text route for use in Twig,
- Use {{ render(path(...)) }} in Twig to call a controller and inject dynamic data,
- Pass parameters to product controllers via expression in Sylius configuration,
- Generate links to brand-specific product lists dynamically in Twig.
The result is a fully dynamic, data-driven menu that scales and updates automatically – all powered by Sylius's native resource system and best practices.