Magento的UI对象层次结构中的阴影标签是什么?

[英]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

我在探索Magento内部,在小部件/标签渲染层次结构中有一个阴影标签的概念,我有点模糊。在为窗体定义制表符时,可以将其绑定为一个影子制表符

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

bindShadowTabs方法是带有文档的

/**
 * 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

利用PHP对象的Javascript看起来是这样的

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?

从基本的阅读资料来看,我并不完全清楚让一个标签“依赖”另一个标签意味着什么。如果customer_options选项卡被呈现,这个简单的“只呈现bundle_item标签”吗?或更多的东西吗?

1 个解决方案

#1


5  

It seems like it means that whenever any of the tabs that are bound together as shadowTabs is displayed the other tabs in this grop will also be rendered.

这似乎意味着,当作为shadowTabs绑定在一起的任何一个选项卡被显示时,这个grop中的其他选项卡也将被显示出来。

so not "only render the bundle_item tab if the customer_options tab is rendered" but rather "whenever the bundle_item tab or the customer_options tab is rendered, render the other one as well".

因此,不是“只有在customer_options选项卡被呈现时才呈现bundle_item选项卡”,而是“当bundle_item选项卡或customer_options选项卡被呈现时,也呈现另一个选项卡”。

not sure I like the metaphor of a shadow though.

我不确定我喜欢影子的比喻。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2011/05/25/d349673ee67cba49947b1b4f0f591d6e.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号