_children) ? '' : trim($this->getChildHtml('', true, true)); if ($this->_dependsOnChildren && empty($html)) { return ''; } if ($this->_isInvisible()) { return $html; } $id = $this->hasElementId() ? sprintf(' id="%s"', $this->getElementId()) : ''; $class = $this->hasElementClass() ? sprintf(' class="%s"', $this->getElementClass()) : ''; $otherParams = $this->hasOtherParams() ? ' ' . $this->getOtherParams() : ''; return sprintf('<%1$s%2$s%3$s%4$s>%5$s', $this->getElementTagName(), $id, $class, $otherParams, $html); } /** * Wrapper element tag name getter * @return string */ public function getElementTagName() { $tagName = $this->_getData('html_tag_name'); return $tagName ? $tagName : 'div'; } /** * Setter whether this block depends on children * @param $depends * @return Mage_Page_Block_Html_Wrapper */ public function dependsOnChildren($depends = '0') { $this->_dependsOnChildren = (bool)(int)$depends; return $this; } /** * Whether the wrapper element should be eventually rendered * If it becomes "invisible", the behaviour will be somewhat similar to core/text_list * * @return bool */ protected function _isInvisible() { if (!$this->hasMayBeInvisible()) { return false; } foreach ($this->_children as $child) { if ($child->hasWrapperMustBeVisible()) { return false; } } return true; } }