translation = $translation; } public function initRuntime(Twig_Environment $environment) { $environment->registerUndefinedFunctionCallback(function () { return; }); $environment->registerUndefinedFilterCallback(function () { return; }); } /** * We need to define and reset each twig function as the definition * of theses function is stored in PrestaShop codebase. */ public function getFunctions() { return [ new \Twig_SimpleFunction('renderhooksarray', [$this, 'transChoice']), ]; } /** * @param $string * * @return string */ public function transChoice($string) { return $this->translation->transChoice($string); } /** * {@inheritdoc} */ public function getName() { return 'app'; } }