コード例 #1
0
 /**
  * Create a new extension instance. Registers Twig undefined function callback.
  *
  * @param Illuminate\Foundation\Application $app
  * @param Twig_Environment                  $twig
  */
 public function __construct(Application $app, Twig_Environment $twig)
 {
     parent::__construct($app, $twig);
     $aliases = $app['config']->get('app.aliases', array());
     $shortcuts = $app['config']->get('twigbridge::alias_shortcuts', array());
     $this->setAliases($aliases);
     $this->setShortcuts($shortcuts);
     $loader = $this;
     // Register Twig callback to handle undefined functions
     $twig->registerUndefinedFunctionCallback(function ($name) use($loader) {
         // Allow any method on aliased classes
         return $loader->getFunction($name);
     });
 }
コード例 #2
0
 /**
  * Create a new extension instance. Registers Twig undefined function callback.
  *
  * @param Illuminate\Foundation\Application $app
  * @param Twig_Environment                  $twig
  */
 public function __construct(Application $app, Twig_Environment $twig)
 {
     parent::__construct($app, $twig);
     $this->registerTwigFunctions();
 }
コード例 #3
0
 /**
  * Create a new extension instance.
  *
  * @param \Illuminate\Foundation\Application|\Illuminate\Foundation\Application $app
  * @param Twig_Environment                                                      $twig
  */
 public function __construct(Application $app, Twig_Environment $twig)
 {
     parent::__construct($app, $twig);
     $this->functions = $app['config']->get('twigbridge::functions', array());
     $this->filters = $app['config']->get('twigbridge::filters', array());
 }