/** * {@inheritdoc} */ public function initialize(Engine $engine) { // directives $engine->addDirective(new BlockDirective()); $engine->addDirective(new ControlDirective()); $engine->addDirective(new ExtendDirective()); $engine->addDirective(new IncludeDirective()); $engine->addDirective(new RawDirective()); $engine->addDirective(new SetDirective()); // functions $engine->addFunction('e', array($engine, 'escape')); $engine->addFunction('escape', array($engine, 'escape')); $engine->addFunction('block', array($this, 'block')); $engine->addFunction('constant', array($this, 'getConstant')); $engine->addFunction('json', 'json_encode'); $engine->addFunction('upper', 'strtoupper'); $engine->addFunction('lower', 'strtolower'); $engine->addFunction('format', 'sprintf'); $engine->addFunction('replace', 'strtr'); }