What are Shadow Tabs in Magento's UI Object Hierarchy?

I'm poking around the Magento internals, and within the Widget/Tab rendering hierarchy there's this concept of Shadow Tabs that I'm a little fuzzy on. When you're defining tabs for your form, you can bind it as a shadow tab

protected function _prepareLayout()
{
    parent::_prepareLayout();
    $this->addTab('bundle_items', array(
        'label'     => Mage::helper('bundle')->__('Bundle Items'),
        'url'   => $this->getUrl('*/*/bundles', array('_current' => true)),
        'class' => 'ajax',
    ));
    $this->bindShadowTabs('bundle_items', 'customer_options');
}

The bindShadowTabs method is documents with

/**
 * Mark tabs as dependent of each other
 * Arbitrary number of tabs can be specified, but at least two
 *
 * @param string $tabOneId
 * @param string $tabTwoId
 * @param string $tabNId...
 */
public function bindShadowTabs($tabOneId, $tabTwoId)

The Javascript that leverages the PHP objects looks like

showTabContentImmediately : function(tab) {
    this.hideAllTabsContent();
    var tabContentElement = $(this.getTabContentElementId(tab));
    if (tabContentElement) {
        Element.show(tabContentElement);
        Element.addClassName(tab, 'active');
        // load shadow tabs, if any
        if (tab.shadowTabs && tab.shadowTabs.length) {
            for (var k in tab.shadowTabs) {
                this.loadShadowTab($(tab.shadowTabs[k]));
            }
        }
        if (!Element.hasClassName(tab, 'ajax only')) {
            Element.removeClassName(tab, 'notloaded');
        }
        this.activeTab = tab;
    }
    if (varienGlobalEvents) {
        varienGlobalEvents.fireEvent('showTab', {tab:tab});
    }
},

From a basic reading, it's not entirely clear to me what the implications of making one tab "dependent" on another is. Is this a simple "only render the bundle_item tab if the customer_options tab is rendered? Or something more?

11
задан Alan Storm 25 May 2011 в 19:52
поделиться