setExtensions() public method

Registers an array of extensions.
public setExtensions ( array $extensions )
$extensions array An array of extensions
Esempio n. 1
0
 /**
  * Sets the templates path.
  *
  * @param  string            $path
  * @param  \Twig_Environment $twig
  * @param  array             $extensions
  * @return self
  */
 public function setTemplatePath($path, \Twig_Environment $twig = null, $extensions = [])
 {
     $this->paths['templates'] = $path;
     if (is_null($twig)) {
         $loader = new \Twig_Loader_Filesystem($path);
         $twig = new \Twig_Environment($loader);
     }
     $twig->setExtensions($extensions);
     $this->injector->share($twig);
     return $this;
 }
 /**
  * @param \Twig_Environment $twig
  *
  * @return \Twig_Environment
  */
 public static function register(\Twig_Environment $twig)
 {
     $twig->setExtensions(self::getExtensions());
     return $twig;
 }