在Tridion GUI扩展中,如何在上下文菜单中添加图标?

rob*_*rtc 5 tridion

如何在Tridion 2011 GUI扩展上下文菜单项中添加图标?

它是在主题或GUI扩展配置?

尺寸是16px吗?

joh*_*ter 10

是的图标是16 x 16.

我总是使用CSS完成它,我希望这个解释有意义:

1)在editor.config中,指定所需的css文件和其他资源

<cfg:groups>
  <cfg:group name="PowerTools.Resources.Base" merge="always">
    <cfg:fileset>
        <cfg:file type="style">/PowerTools/Client/Shared/Theme/styles.css</cfg:file>
Run Code Online (Sandbox Code Playgroud)

2)配置上下文菜单时,ContextMenuItem中有ID属性(如下所示为PT_PagePublisher)

<ext:contextmenus>
  <ext:add>
    <ext:extension name="PowerToolsContextMenu" assignid="PowerToolsContextMenu" insertbefore="cm_refresh">
      <ext:menudeclaration externaldefinition="">
        <cmenu:ContextMenuItem id="PowerToolsMenuGroup" name="Power Tools">
          <cmenu:ContextMenuItem id="PT_PagePublisher" name="Page Publisher" command="PT_PagePublisher"/>
Run Code Online (Sandbox Code Playgroud)

3)在你的CSS文件中,你会有类似的东西:

.PT_PagePublisher .image {background-image:url({ThemePath}/Icons/pagepublisher_16.png);}
Run Code Online (Sandbox Code Playgroud)

查看CSS类的名称(PT_PagePublisher)如何映射到ContextMenuItem节点中的ID.

我希望这有帮助!

  • 它存储在config xml:中的设置节点中:<settings> <defaultpage> /Views/Default.aspx </ defaultpage> <navigatorurl> /Views/Default.aspx </ navigatorurl> <editurls /> <listdefinitions /> <itemicons /> <theme> <path /> </ theme> <customconfiguration /> </ settings> </ Configuration> (2认同)
  • 另一个注意事项:在你的CSS中你可能有像background-image:url({ThemePath} /images/icon.png); 我发现{ThemePath}不喜欢在引号内,所以background-image:url("{ThemePath} /images/icon-branches-32.png"); 不行 (2认同)