5

Tridion GUI Extension 配置如何将名称映射到 JS 文件?例如,我使用 Jaime 的HelloWorld 帖子和示例文件。感觉最重要的部分是 CommandSet 部分。

<cfg:commandset id="HelloWorldCM.Interface">   
  <cfg:command name="HelloWorldCM" implementation="Extensions.HW"/>
  <cfg:dependencies>
    <cfg:dependency>HelloWorldCM.Commandset</cfg:dependency>
  </cfg:dependencies>
</cfg:commandset>

有人可以帮我理解以下属性以及它们如何映射到扩展的底层 .js 文件吗?

  • 姓名
  • 执行
  • cfg:依赖

我尝试在 config 和 js 文件中更改这些内容,但它们的映射方式是一个谜。

4

1 回答 1

10

您提到的三个属性实际上都是将整个扩展联系在一起的指针。如果您在 Jamie 的示例中往上看,您会看到:

<ext:contextmenus>
  <ext:add>
    <ext:extension name="HelloWorldCMExtension" assignid="" insertbefore="cm_refresh">
      <ext:menudeclaration>
        <cmenu:ContextMenuItem id="ext_HelloWorldCM" name="Hello World!" command="HelloWorldCM"/>
      </ext:menudeclaration>                            
      <ext:dependencies>
        <cfg:dependency>HelloWorldCM.Example</cfg:dependency>
      </ext:dependencies>              
      <ext:apply>
        <ext:view name="DashboardView"/>
      </ext:apply>
    </ext:extension>
  </ext:add>          
</ext:contextmenus>

此 XML 将一个按钮添加到 CME 的上下文菜单。

command="HelloWorldCM"指具有匹配name属性的命令commandset

implementation="Extensions.HW"在命令集中实际上是指随附的 HellowWorldCM.js 文件中的命名空间

cfg:dependency指向<cfg:group name="HelloWorldCM.Commandset" merger="Tridion.Web.UI.Core.Configuration.Resources.CommandGroupProcessor" merge="always">节点上配置文件的顶部,以便知道要包含哪些 CSS 和 JS。

于 2012-02-22T11:36:50.867 回答