public function TwigExtension::drupalDump in Twig Tweak 8.2
Same name and namespace in other branches
- 8 src/TwigExtension.php \Drupal\twig_tweak\TwigExtension::drupalDump()
Dumps information about variables.
Parameters
array $context: Variables from the Twig template.
mixed $variable: (optional) The variable to dump.
File
- src/
TwigExtension.php, line 874
Class
- TwigExtension
- Twig extension with some useful functions and filters.
Namespace
Drupal\twig_tweakCode
public function drupalDump(array $context, $variable = NULL) {
$var_dumper = '\\Symfony\\Component\\VarDumper\\VarDumper';
if (class_exists($var_dumper)) {
call_user_func($var_dumper . '::dump', func_num_args() == 1 ? $context : $variable);
}
else {
trigger_error('Could not dump the variable because symfony/var-dumper component is not installed.', E_USER_WARNING);
}
}