public function __construct(ViewInterface $view, ExpressViewHelperManagerInterface $helpers, ExpressionContextFactoryInterface $contextFactory, ExpressViewFactory $factory)
 {
     parent::__construct($view);
     $this->factory = $factory;
     $this->helpers = $helpers;
     $this->expressionContextFactory = new ExpressionContextFactory($contextFactory);
     $this->expressionContextFactory->setDefaultAccessPolicy(ExpressionContextInterface::ACCESS_POLICY_RETURN_NULL);
     $this->expressionContextFactory->registerExtension($this);
 }
Example #2
0
 public function createExpressionContextFactory(ContainerInterface $container)
 {
     $factory = new ExpressionContextFactory();
     $container->eachMarked(function (ExpressionExtension $extension, BindingInterface $binding) use($factory, $container) {
         $factory->registerExtension($container->getBound($binding));
     });
     $container->eachMarked(function (ExpressionResolver $resolver, BindingInterface $binding) use($factory, $container) {
         $factory->getResolvers()->registerResolver($container->getBound($binding));
     });
     return $factory;
 }