<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Engine_View_Helper_HtmlContainer extends Zend_View_Helper_HtmlElement
{
  protected $_ignoreOnEmptyContent = true;
  
  public function htmlContainer($content, $attribs = array())
  {
    $tag = 'div';
    if( !empty($attribs['tag']) ) {
      if( is_string($attribs['tag']) ) {
        $tag = $attribs['tag'];
      }
      unset($attribs['tag']);
    }

    // Empty content
    if( empty($content) ) {
      if( $this->_ignoreOnEmptyContent ) {
        return '';
      } else {
        $closingBracket = $this->getClosingBracket();
        return '<' . $tag . $this->_htmlAttribs($attribs) . $closingBracket;
      }
    }

    return '<' . $tag
      . $this->_htmlAttribs($attribs)
      . '>'
      . $content
      . '</'
      . $tag
      . '>';
  }
}
