How works the render about the homepage?
This post is available in frenchWhen we go to the controller vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Controller/HomepageController.php
we get:
<?php
namespace Sylius\Bundle\ShopBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
final class HomepageController
{
/** @var EngineInterface */
private $templatingEngine;
public function __construct(EngineInterface $templatingEngine)
{
$this->templatingEngine = $templatingEngine;
}
public function indexAction(Request $request): Response
{
return $this->templatingEngine->renderResponse('@SyliusShop/Homepage/index.html.twig');
}
}
and this is what contains the content of index.html.twig which is returned by the action:
{% extends '@SyliusShop/layout.html.twig' %}
{% block content %}
<div class="homepage">
<div class="ui hidden divider"></div>
{{ sylius_template_event('sylius.shop.homepage') }}
</div>
{% endblock %}
To find everything that makes the homepage you have to look the event sylius.shop.homepage
. The file is in the file vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/config/app/config.yml
which will tell us all the templates that are called:
sylius.shop.homepage:
blocks:
banner:
template: "@SyliusShop/Homepage/_banner.html.twig"
priority: 60
latest_products:
template: "@SyliusShop/Homepage/_latestProducts.html.twig"
priority: 50
latest_products_carousel:
template: "@SyliusShop/Homepage/_latestProductsCarousel.html.twig"
priority: 40
newsletter:
template: "@SyliusShop/Homepage/_newsletter.html.twig"
priority: 30
products_grid:
template: "@SyliusShop/Homepage/_productsGrid.html.twig"
priority: 20
about_us:
template: "@SyliusShop/Homepage/_aboutUs.html.twig"
priority: 10
Here is the list of templates that are on the homepage