public static function TwigTweakExtension::drupalDump in Twig Tweak 3.1.x
Same name and namespace in other branches
- 3.x src/TwigTweakExtension.php \Drupal\twig_tweak\TwigTweakExtension::drupalDump()
Dumps information about variables.
Parameters
array $context: Variables from the Twig template.
mixed $variable: (optional) The variable to dump.
File
- src/
TwigTweakExtension.php, line 303
Class
- TwigTweakExtension
- Twig extension with some useful functions and filters.
Namespace
Drupal\twig_tweakCode
public static function drupalDump(array $context, $variable = NULL) : void {
$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);
}
}