function DebugExtension::dump
Same name in other branches
- 10 core/lib/Drupal/Core/Template/DebugExtension.php \Drupal\Core\Template\DebugExtension::dump()
- 11.x core/lib/Drupal/Core/Template/DebugExtension.php \Drupal\Core\Template\DebugExtension::dump()
Dumps information about variables using Symfony VarDumper.
Parameters
\Twig\Environment $env: The Twig environment.
array $context: Variables from the Twig template.
array $variables: (optional) Variable(s) to dump.
File
-
core/
lib/ Drupal/ Core/ Template/ DebugExtension.php, line 50
Class
- DebugExtension
- A class providing Drupal Twig Debug extension.
Namespace
Drupal\Core\TemplateCode
public static function dump(Environment $env, array $context, ...$variables) : void {
if (!$env->isDebug()) {
return;
}
if (class_exists(self::SYMFONY_VAR_DUMPER_CLASS)) {
if (func_num_args() === 2) {
call_user_func(self::SYMFONY_VAR_DUMPER_CLASS . '::dump', $context);
}
else {
array_walk($variables, self::SYMFONY_VAR_DUMPER_CLASS . '::dump');
}
}
else {
throw new \LogicException('Could not dump the variable because symfony/var-dumper component is not installed.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.