Latte\Engine::getCompiler PHP Method

getCompiler() public method

public getCompiler ( ) : Compiler
return Compiler
    public function getCompiler()
    {
        if (!$this->compiler) {
            $this->compiler = new Compiler();
            Macros\CoreMacros::install($this->compiler);
            Macros\BlockMacros::install($this->compiler);
        }
        return $this->compiler;
    }

Usage Example

 /**
  * @return \Nette\Bridges\ApplicationLatte\Template
  */
 protected function createTemplate()
 {
     $latte = new Latte\Engine();
     $latte->onCompile[] = function ($latte) {
         Bridges\FormsLatte\FormMacros::install($latte->getCompiler());
     };
     return new Bridges\ApplicationLatte\Template($latte);
 }
All Usage Examples Of Latte\Engine::getCompiler