4

I have my custom listdefinitions up and running quite good but have just some fine-tuning left to do. I would want to add some custom icons instead of those that are used by Tridion. I have defined my own column according to how Tridion does it for his icons.

<list:column id="IconColumn" type="icon" title="" selector="@ItemIcon" width="20" enableresizing="false" enablesorting="false" enablefiltering="false" />

I also added the following to the editor.config:

<itemicons>
  <icon match="act\." path="/Themes/Default/Icons/mmIcons/${icon}.${size}x${size}.png" />
</itemicons>

And the icons are available.

The question now is, what do I give as data from the Data Extender to get the icons that I want?

1 Answer 1

3

List definitions processed by Tridion.Controls.ListDefinition, where Tridion.Controls.ListColumn is created for each list column.

If the column represents an icon, Tridion.Controls.ListColumn resolves icon path

Tridion.Controls.ListColumn.prototype.getIconPath = function ListColumn$getIconPath(iconValue)
{
    return $config.getIconPath(iconValue, 16);
};

Where

$config.getIconPath = function Configuration$getIconPath(iconName, iconSize, forceLoad, editor)
{
    return $config.expandThemePath("icon{2}.png?name={0}&size={1}{3}".format(iconName, iconSize || "16", $config.getPathVersion(), forceLoad ? "&" + (new Date()).getTime() : ""), editor);
};

Where icon.png is processed by Tridion.Web.UI.Core.Http.IconUrlRewriter

Which eventually does processing based on configuration rules.

Based on your configuration, for instance request like:

<bc:Item ItemIcon="beard"/>

will be resolved from /Themes/Default/Icons/mmIcons/beard.16x16.png (if requested from list details view)

And from /Themes/Default/Icons/mmIcons/beard.48x48.png (if requested from thumbnails view)

UPDATE:

To use your Extension theme, you should add ${theme} to your icon path

<settings>
    ...
    <itemicons>
      <icon match="act\." path="${theme}Icons/mmIcons/${icon}.${size}x${size}.png" />
    </itemicons>
    <theme>
        <path>/Themes/Default/</path>
    </theme>
    ...
</settings>
3
  • Thanks for the in-depth answer! But is there a nice way to include icons without putting them into the CME? My solution to this was overwriting the $config.getIconPath a function that checked the iconName for a special sequence and would change the editor string to the name of my own editor. But this is quite hacky so I was wondering if there was a nicer way. Commented Oct 31, 2014 at 8:03
  • See update section. It should help Commented Oct 31, 2014 at 12:49
  • Yeah, but it is only 1/2 of the problem. The function $config.getIconPath has a parameter editor which should be set to 'MyEditor' but ListColumn does not pass param to $config.getIconPath. Commented Nov 3, 2014 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.