private function Debug::doDump in Devel 4.x
Parameters
\Twig_Environment $env:
array $context:
array $args:
null $plugin_id:
Return value
false|string|null
2 calls to Debug::doDump()
- Debug::dump in src/
Twig/ Extension/ Debug.php - Provides debug function to Twig templates.
- Debug::kint in src/
Twig/ Extension/ Debug.php - Similar to dump() but always uses the kint dumper if available.
File
- src/
Twig/ Extension/ Debug.php, line 97
Class
- Debug
- Provides the Devel debugging function within Twig templates.
Namespace
Drupal\devel\Twig\ExtensionCode
private function doDump(\Twig_Environment $env, array $context, array $args = [], $plugin_id = NULL) {
if (!$env
->isDebug()) {
return NULL;
}
ob_start();
// No arguments passed, display full Twig context.
if (empty($args)) {
$context_variables = $this
->getContextVariables($context);
$this->dumper
->dump($context_variables, 'Twig context', $plugin_id);
}
else {
$parameters = $this
->guessTwigFunctionParameters();
foreach ($args as $index => $variable) {
$name = !empty($parameters[$index]) ? $parameters[$index] : NULL;
$this->dumper
->dump($variable, $name, $plugin_id);
}
}
return ob_get_clean();
}