How does the Tridion GUI Extensions CommandSet map to js methods?

我们两清 提交于 2019-12-07 07:17:50

问题


How does the Tridion GUI Extension config map the names to the JS file? For example, I am using Jaime's HelloWorld post with example files. The most important part feels to be the CommandSet section.

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

Can someone please help me understand the following attributes and how they map to the underlying .js file for the extension?

  • name
  • implementation
  • cfg:dependency

I have tried changing these things in both config and js file but how they are mapped is a mystery.


回答1:


The three attributes you mention are really all pointers that tie the whole extension together. If you look higher up in the Jamie's sample, you will see this:

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

This XML adds a button to the CME's context menu.

command="HelloWorldCM" refers to the command with the matching name attribute in the commandset

implementation="Extensions.HW" in the command set actually refers to the namespace in the accompanying HellowWorldCM.js file

cfg:dependency points to the top of the config file at the <cfg:group name="HelloWorldCM.Commandset" merger="Tridion.Web.UI.Core.Configuration.Resources.CommandGroupProcessor" merge="always"> node in order to know which CSS and JS to include.



来源:https://stackoverflow.com/questions/9393851/how-does-the-tridion-gui-extensions-commandset-map-to-js-methods

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!