em = $em ; $this->security = $security ; $this->repositoryProductCategory = $repositoryProductCategory ; $this->globalParam = $globalParam ; $this->formFactory = $formFactory ; } public function getFunctions() { return array( new TwigFunction('get_product_categories', [$this, 'getProductCategories']), new TwigFunction('get_form_newsletter', [$this, 'getFormNewsletter']), ); } public function getFilters() { return [ new TwigFilter('format_price', [$this, 'format_price']), ]; } public function getProductCategories() { $categories = $this->repositoryProductCategory->findAllParents($this->globalParam->getCurrentMerchant()) ; return $categories ; } public function getFormNewsletter() { $form = $this->formFactory->create(NewsletterType::class); return $form->createView() ; } public function format_price($price) { $price = number_format($price, 2) ; $price = str_replace('.',',',$price) ; $price = $price .' €' ; return $price ; } }