Example #1
0
 /**
  * Provides debug function to Twig templates.
  *
  * Handles 0, 1, or multiple arguments.
  *
  * @param \Twig_Environment $env
  *   The twig environment instance.
  * @param array $context
  *   An array of parameters passed to the template.
  * @param array $args
  *   An array of parameters passed the function.
  *
  * @return void
  *
  * @see \Drupal\devel\DevelDumperManager::message()
  */
 public function message(\Twig_Environment $env, array $context, array $args = [])
 {
     if (!$env->isDebug()) {
         return;
     }
     // No arguments passed, display full Twig context.
     if (empty($args)) {
         $context_variables = $this->getContextVariables($context);
         $this->dumper->message($context_variables, 'Twig context');
     } else {
         foreach ($args as $variable) {
             $this->dumper->message($variable);
         }
     }
 }
 /**
  * @return array
  */
 public function exportRenderable()
 {
     return $this->dumper->exportAsRenderable('Test output');
 }