diff --git a/modules/cms/twig/DebugExtension.php b/modules/cms/twig/DebugExtension.php index d6982bf95..fcfb6731b 100644 --- a/modules/cms/twig/DebugExtension.php +++ b/modules/cms/twig/DebugExtension.php @@ -12,6 +12,7 @@ use October\Rain\Database\Model; class DebugExtension extends Twig_Extension { const PAGE_CAPTION = 'Page variables'; + const ARRAY_CAPTION = 'Array variables'; const OBJECT_CAPTION = 'Object variables'; const COMPONENT_CAPTION = 'Component variables'; @@ -100,11 +101,20 @@ class DebugExtension extends Twig_Extension $this->variablePrefix = false; for ($i = 2; $i < $count; $i++) { $var = func_get_arg($i); - $caption = $var instanceof ComponentBase - ? static::COMPONENT_CAPTION - : static::OBJECT_CAPTION; + $subcaption = null; - $result .= $this->dump($var, $caption); + if ( $var instanceof ComponentBase ) + $caption = static::COMPONENT_CAPTION; + elseif ( is_array($var) ) + $caption = static::ARRAY_CAPTION; + else + { + $caption = static::OBJECT_CAPTION; + $subcaption = get_class($var); + } + + + $result .= $this->dump($var, $caption, $subcaption); } } @@ -126,9 +136,10 @@ class DebugExtension extends Twig_Extension * * @param mixed $variable Variable to dump * @param string $caption Caption of the dump + * @param string $subcaption Subcaption of the dump * @return void */ - public function dump($variables = null, $caption = null) + public function dump($variables = null, $caption = null, $subcaption = null) { $this->commentMap = []; $this->zebra = 1; @@ -148,7 +159,7 @@ class DebugExtension extends Twig_Extension $output[] = '
'.$caption.''; + $output[] = ' | ';
+ $output[] = $caption;
+ if ($subcaption)
+ $output[] = ' '.$subcaption.' ';
+ $output[] = '';
$output[] = ' |
---|