在 Tridion GUI 扩展中,如何向上下文菜单添加图标? [英] Within a Tridion GUI Extension, how to add an icon to the context-menu?

查看:19
本文介绍了在 Tridion GUI 扩展中,如何向上下文菜单添加图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将图标添加到我的 Tridion 2011 GUI 扩展上下文菜单项?

How do I add an icon to my Tridion 2011 GUI Extension context-menu item?

是否在主题或 GUI 扩展配置中?

Is it in the theme or GUI Extension config?

大小是 16px 吗?

Is the size 16px?

推荐答案

是的,图标是 16 x 16.

Yes the icon is 16 x 16.

我一直使用 CSS 来完成它,我希望这个解释有意义:

I've always done it using CSS, I hope this explanation makes sense:

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

1) In your editor.config, you specify the css file and other resources you need

<cfg:groups>
  <cfg:group name="PowerTools.Resources.Base" merge="always">
    <cfg:fileset>
        <cfg:file type="style">/PowerTools/Client/Shared/Theme/styles.css</cfg:file>

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

2) When you configure the context menu, you have the ID attribute in the ContextMenuItem (shown below as 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"/>

3) 在您的 CSS 文件中,您将拥有如下内容:

3) In your CSS file you'll have something like:

.PT_PagePublisher .image {background-image:url({ThemePath}/Icons/pagepublisher_16.png);}

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

See how the name of the CSS class (PT_PagePublisher) maps to the ID in the ContextMenuItem node.

我希望这会有所帮助!

这篇关于在 Tridion GUI 扩展中,如何向上下文菜单添加图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆