什么是;更新;元素在Magento布局XML中是什么?

什么是;更新;元素在Magento布局XML中是什么?,magento,layout,magento-1,Magento,Layout,Magento 1,现在我正在探索Magento管理部分的内部内容,我偶然发现了这段XML: 文件:app/design/adminhtml/default/default/layout/catalog.xml,第55行附近 50 <block type="core/template" template="catalog/wysiwyg/js.phtml"/> 51 </reference> 52 </adminhtml_catalog_pro

现在我正在探索Magento管理部分的内部内容,我偶然发现了这段XML:

文件:
app/design/adminhtml/default/default/layout/catalog.xml,第55行附近

50            <block type="core/template" template="catalog/wysiwyg/js.phtml"/>
51        </reference>
52    </adminhtml_catalog_product_new>
53    
54    <adminhtml_catalog_product_edit>
55        <update handle="editor"/>
56        <reference name="content">
57            <block type="adminhtml/catalog_product_edit" name="product_edit"></block>
58        </reference>
50
51
52
53
54
55
56
57
58
标签的作用是什么?

标签基本上会拉入另一个手柄

假设您有:

<layout>
   <foo>
      <reference name="header">
          <block type="cms/block" name="some_block" as="someBlock">
              <action method="setBlockId"><block_id>some_block</block_id></action>
          </block>
      </reference>
      <reference name="left">
          <block type="cms/block" name="some_totally_different_block" as="someTotallyDifferentBlock">
              <action method="setBlockId"><block_id>some_totally_different_block</block_id></action>
          </block>
      </reference>
   </foo>
   <bar>
      <update handle="foo" /> 
      <reference name="header">
          <block type="cms/block" name="some_other_block" as="someOtherBlock">
              <action method="setBlockId"><block_id>some_other_block</block_id></action>
          </block>
      </reference>
   </bar>
</layout>

tl;dr:更新句柄基本上是“将此布局与我的当前布局合并”。

此句柄用于将现有布局句柄合并到当前布局。 在您的示例中,
将向
添加以下内容:

<editor>
    <reference name="head">
        <action method="setCanLoadExtJs"><flag>1</flag></action>
        <action method="addJs"><script>mage/adminhtml/variables.js</script></action>
        <action method="addJs"><script>mage/adminhtml/wysiwyg/widget.js</script></action>
        <action method="addJs"><script>lib/flex.js</script></action>
        <action method="addJs"><script>lib/FABridge.js</script></action>
        <action method="addJs"><script>mage/adminhtml/flexuploader.js</script></action>
        <action method="addJs"><script>mage/adminhtml/browser.js</script></action>
        <action method="addJs"><script>prototype/window.js</script></action>
        <action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
        <action method="addItem"><type>js_css</type><name>prototype/windows/themes/magento.css</name></action>
    </reference>
</editor>

1.
mage/adminhtml/variables.js
mage/adminhtml/wysiwyg/widget.js
lib/flex.js
lib/FABridge.js
mage/adminhtml/flexuploader.js
mage/adminhtml/browser.js
prototype/window.js
js_cssprotype/windows/themes/default.css
js_cssprotype/windows/themes/magento.css

(“编辑器”句柄在
app/design/adminhtml/default/default/layout/main.xml
中定义)

Magento如何知道句柄在main.xml中?如果另一个自定义xml文件包含句柄怎么办?这也会被合并吗?我想Magento会合并这两个句柄。嗯,这是否意味着Magento会在layout文件夹中的所有xml文件中搜索句柄?抱歉,但不太明白。@此时已加载并解析了所有HashidHameed XML文件。@rahmanisback由于更新处理程序本身是一个尚待解析的XML元素,在执行更新处理程序时如何解析所有XML文件?
<editor>
    <reference name="head">
        <action method="setCanLoadExtJs"><flag>1</flag></action>
        <action method="addJs"><script>mage/adminhtml/variables.js</script></action>
        <action method="addJs"><script>mage/adminhtml/wysiwyg/widget.js</script></action>
        <action method="addJs"><script>lib/flex.js</script></action>
        <action method="addJs"><script>lib/FABridge.js</script></action>
        <action method="addJs"><script>mage/adminhtml/flexuploader.js</script></action>
        <action method="addJs"><script>mage/adminhtml/browser.js</script></action>
        <action method="addJs"><script>prototype/window.js</script></action>
        <action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
        <action method="addItem"><type>js_css</type><name>prototype/windows/themes/magento.css</name></action>
    </reference>
</editor>