diff --git a/src/DebugBar/JavascriptRenderer.php b/src/DebugBar/JavascriptRenderer.php index 41c17c55..7cc16b02 100644 --- a/src/DebugBar/JavascriptRenderer.php +++ b/src/DebugBar/JavascriptRenderer.php @@ -62,6 +62,8 @@ class JavascriptRenderer protected $useRequireJs = false; + protected $hideEmptyTabs = null; + protected $initialization; protected $controls = array(); @@ -157,6 +159,9 @@ public function setOptions(array $options) if (array_key_exists('use_requirejs', $options)) { $this->setUseRequireJs($options['use_requirejs']); } + if (array_key_exists('hide_empty_tabs', $options)) { + $this->setHideEmptyTabs($options['hide_empty_tabs']); + } if (array_key_exists('controls', $options)) { foreach ($options['controls'] as $name => $control) { $this->addControl($name, $control); @@ -397,6 +402,29 @@ public function isRequireJsUsed() return $this->useRequireJs; } + + /** + * Sets whether to hide empty tabs or not + * + * @param boolean $hide + * @return $this + */ + public function setHideEmptyTabs($hide = true) + { + $this->hideEmptyTabs = $hide; + return $this; + } + + /** + * Checks if empty tabs are hidden or not + * + * @return boolean + */ + public function areEmptyTabsHidden() + { + return $this->hideEmptyTabs; + } + /** * Adds a control to initialize * @@ -1036,7 +1064,7 @@ public function renderOnShutdownWithHead($here = true, $initialize = true, $rend public function replaceTagInBuffer($here = true, $initialize = true, $renderStackedData = true, $head = false) { $render = ($head ? $this->renderHead() : "") - . $this->render($initialize, $renderStackedData); + . $this->render($initialize, $renderStackedData); $current = ($here && ob_get_level() > 0) ? ob_get_clean() : self::REPLACEABLE_TAG; @@ -1075,7 +1103,7 @@ public function render($initialize = true, $renderStackedData = true) $nonce = $this->getNonceAttribute(); - if ($nonce != '') { + if ($nonce != '') { $js = preg_replace("/