public function DevelDebugLogExtension::ddl in Devel Debug Log 8
Provides ddl function to Twig templates.
Parameters
Twig_Environment $env: The twig environment instance.
array $context: An array of parameters passed to the template.
File
- src/
Twig/ DevelDebugLogExtension.php, line 41
Class
- DevelDebugLogExtension
- Provides the Debug log debugging function within Twig templates.
Namespace
Drupal\devel_debug_log\TwigCode
public function ddl(\Twig_Environment $env, array $context) {
// Don't do anything unless twig_debug is enabled. This reads from the Twig
if (!$env
->isDebug()) {
return;
}
if (func_num_args() === 2) {
// No arguments passed, display full Twig context.
$ddl_variables = array();
foreach ($context as $key => $value) {
if (!$value instanceof \Twig_Template) {
$ddl_variables[$key] = $value;
}
}
ddl($ddl_variables, $this
->t('Context as array'));
}
else {
$args = array_slice(func_get_args(), 2);
if (isset($args[1])) {
ddl($args[0], (string) $args[1]);
}
else {
ddl($args[0]);
}
}
}