You are here

public function Twig_Environment::addTokenParser in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Environment.php \Twig_Environment::addTokenParser()

Registers a Token Parser.

Parameters

Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance:

File

vendor/twig/twig/lib/Twig/Environment.php, line 845

Class

Twig_Environment
Stores the Twig configuration.

Code

public function addTokenParser(Twig_TokenParserInterface $parser) {
  if ($this->extensionInitialized) {
    throw new LogicException('Unable to add a token parser as extensions have already been initialized.');
  }
  $this->staging
    ->addTokenParser($parser);
}