Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

tridion

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.

like image 433
robrtc Avatar asked Feb 22 '12 11:02

robrtc


1 Answers

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.

like image 93
Chris Summers Avatar answered Oct 06 '22 21:10

Chris Summers