<?php

namespace KupShop\ContentBundle\Controller;

use KupShop\KupShopBundle\Views\View;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class FocusController extends AbstractController
{
    #[Route('/_focus/lazy/{template}', requirements: ['template' => '[-_\w]+'])]
    public function focusLazyAction(string $template, Request $request, View $view): Response
    {
        return $view
            ->setTemplate("focus_lazy/{$template}.tpl")
            ->setSmartyFallback('blank')
            ->addBodyVariables(iterator_to_array($request->query->getIterator()))
            ->getResponse();
    }
}
