You are here

protected function Twig_Environment::initGlobals in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Environment.php \Twig_Environment::initGlobals()
2 calls to Twig_Environment::initGlobals()
Twig_Environment::addGlobal in vendor/Twig/Environment.php
Registers a Global.
Twig_Environment::getGlobals in vendor/Twig/Environment.php
Gets the registered Globals.

File

vendor/Twig/Environment.php, line 1128

Class

Twig_Environment
Stores the Twig configuration.

Code

protected function initGlobals() {
  $globals = array();
  foreach ($this->extensions as $extension) {
    $extGlob = $extension
      ->getGlobals();
    if (!is_array($extGlob)) {
      throw new UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', get_class($extension)));
    }
    $globals[] = $extGlob;
  }
  $globals[] = $this->staging
    ->getGlobals();
  return call_user_func_array('array_merge', $globals);
}