Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Catalog_Block_Seo_Sitemap_Tree_Pager
  • Mage_Page_Block_Html
  • Mage_Page_Block_Html_Breadcrumbs
  • Mage_Page_Block_Html_Footer
  • Mage_Page_Block_Html_Head
  • Mage_Page_Block_Html_Header
  • Mage_Page_Block_Html_Notices
  • Mage_Page_Block_Html_Pager
  • Mage_Page_Block_Html_Topmenu
  • Mage_Page_Block_Html_Welcome
  • Mage_Page_Block_Html_Wrapper
  • Mage_Page_Block_Js_Cookie
  • Mage_Page_Block_Redirect
  • Mage_Page_Helper_Data
  • Mage_Page_Helper_Html
  • Mage_Page_Helper_Layout
  • Mage_Page_Model_Config
  • Mage_Page_Model_Source_Layout
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Page
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * A generic wrapper block that renders its children and supports a few parameters of the wrapper HTML-element
 29:  */
 30: class Mage_Page_Block_Html_Wrapper extends Mage_Core_Block_Abstract
 31: {
 32:     /**
 33:      * Whether block should render its content if there are no children (no)
 34:      * @var bool
 35:      */
 36:     protected $_dependsOnChildren = true;
 37: 
 38:     /**
 39:      * Render the wrapper element html
 40:      * Supports different optional parameters, set in data by keys:
 41:      * - element_tag_name (div by default)
 42:      * - element_id
 43:      * - element_class
 44:      * - element_other_attributes
 45:      *
 46:      * Renders all children inside the element.
 47:      *
 48:      * @return string
 49:      */
 50:     protected function _toHtml()
 51:     {
 52:         $html = empty($this->_children) ? '' : trim($this->getChildHtml('', true, true));
 53:         if ($this->_dependsOnChildren && empty($html)) {
 54:             return '';
 55:         }
 56:         if ($this->_isInvisible()) {
 57:             return $html;
 58:         }
 59:         $id          = $this->hasElementId() ? sprintf(' id="%s"', $this->getElementId()) : '';
 60:         $class       = $this->hasElementClass() ? sprintf(' class="%s"', $this->getElementClass()) : '';
 61:         $otherParams = $this->hasOtherParams() ? ' ' . $this->getOtherParams() : '';
 62:         return sprintf('<%1$s%2$s%3$s%4$s>%5$s</%1$s>', $this->getElementTagName(), $id, $class, $otherParams, $html);
 63:     }
 64: 
 65:     /**
 66:      * Wrapper element tag name getter
 67:      * @return string
 68:      */
 69:     public function getElementTagName()
 70:     {
 71:         $tagName = $this->_getData('html_tag_name');
 72:         return $tagName ? $tagName : 'div';
 73:     }
 74: 
 75:     /**
 76:      * Setter whether this block depends on children
 77:      * @param $depends
 78:      * @return Mage_Page_Block_Html_Wrapper
 79:      */
 80:     public function dependsOnChildren($depends = '0')
 81:     {
 82:         $this->_dependsOnChildren = (bool)(int)$depends;
 83:         return $this;
 84:     }
 85: 
 86:     /**
 87:      * Whether the wrapper element should be eventually rendered
 88:      * If it becomes "invisible", the behaviour will be somewhat similar to core/text_list
 89:      *
 90:      * @return bool
 91:      */
 92:     protected function _isInvisible()
 93:     {
 94:         if (!$this->hasMayBeInvisible()) {
 95:             return false;
 96:         }
 97:         foreach ($this->_children as $child) {
 98:             if ($child->hasWrapperMustBeVisible()) {
 99:                 return false;
100:             }
101:         }
102:         return true;
103:     }
104: }
105: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0