public function Twig_Environment::addTokenParser

Registers a Token Parser.

Parameters

Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance:

File

drupal/core/vendor/twig/twig/lib/Twig/Environment.php, line 681

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);
}