<?php
namespace App\Twig;
use App\Service\SearchByKeywordsService;
use Symfony\Component\Form\FormView;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
class SearchByKeywordsExtension extends AbstractExtension
{
public function __construct(
private SearchByKeywordsService $searchByKeywordsService
) {}
public function getFunctions()
{
return [
new TwigFunction('search_by_keywords_form', [$this, 'getSearchByKeywordsFormView']),
];
}
public function getSearchByKeywordsFormView(): FormView
{
return $this->searchByKeywordsService->getSearchByKeywordsForm()->createView();
}
}