Loading...

All project content is available for reading, but you need to be a member of the project for Subversion checkout of source code, or to create/modify any information.
Login if you are a member. Apply here to request membership (open to all).

Configuration

The configuration of the PageTreeIcons module is done in an own section of the web.config. The section is made up of two main parts.

Handlers

The <handlers> element contains a list of all tree icon handlers that you want available in the tree. A tree icon handler is a class that implements the PageTreeIcons.ITreeIconHandler interface. You specify the handlers with a friendy name and the fully qualified name of the handler. Note that you also need to specify handlers that are built into the PageTreeIcons module. An example of a small handler configuration:

<pageTreeIcons>
  <handlers>
    <add name="LinkType" type="PageTreeIcons.TreeIconHandlers.PageLinkTypeHandler,PageTreeIcons" />
    <add name="MyCustomHandler" type="MyCompany.MyCustomHandler,MyAssembly" />
  </handlers>
</pageTreeIcons>

Mappings

The other main part is the <mappings> element. This section specifies how the handlers should be used and how icons shall be mapped to the pages in the page tree. The attributes used for every mapping is different depending on what handler that is mapped to. The attributes key and handler are required, where key is a unique name for the mapping and handler is the name that was specified in the handlers segment.

An optional iconType attribute that specifies if the icon should a Node icon or a Status icon. Node icons are visible in front of the page name (like the standard icons for the start page or recycle bin) and there can only be one per page. Status icons are displayed after the page name (like 'New page' or 'Not visible in menus') and there are no direct limit to the number of icons that can be displayed. The Node icon type is the default for all the built-in types.

Other common attributes are icon that holds the path to the icon image and toolTip that hold the tool tip text or language xpath string for a Status type icon. Note that you can specify several mappings for the same handler type.

An example of a couple of tree icon mappings:

<pageTreeIcons>
  <mappings>
      <add key="ShortCut" handler="LinkType" iconType="Status" icon="~/Images/PageTreeIcons/Shortcut.gif" toolTip="/path/in/lang/file" linkType="Shortcut" />
      <add key="Custom" handler="MyCustomHandler" customAttribute="CustomSelectionValue" />
      <add key="Custom2" handler="MyCustomHandler" iconType="Status" toolTip="This is the tooltip that is displayed" customAttribute="CustomSelectionValue2" />
  </mappings>
</pageTreeIcons>

Standard handler configuration

The module installer will create the basic configuration needed and specify all standard handlers but you need to specify yourself what icon mappings you want to use. All the standard handlers have different configuration settings that can be setup according to your preferences.

  • IconPropertyHandler - iconType, propertyName (the name of a page property that specifies the path to the icon image) and toolTipPropertyName (name of property that holds the tool tip string).
  • PageTypeHandler - icon, iconType, tooltip and pageTypeId (the ID of page type to show icons for).
  • PageReferenceHandler - icon, iconType, tooltip and pageLink (the ID of the page to show the icon for).
  • PageLinkTypeHandler - icon, iconType, tooltip and linkType (one of the EPiServer.Core.PageShortcutType values - Normal, Shortcut, External, Inactive or FetchData)
  • PropertyHandler - icon, iconType, tooltip, propertyName (name of the page property to check), value (value of the property to match against), empty (boolean value if an empty property is a match) and missing (is the icon should be displayed if the property is missing on the page type)

Full example configuration

The following configuration sample is the full example that is created when installing the example module:

<configuration>
  <configSections>
    <section name="pageTreeIcons" type="PageTreeIcons.PageTreeIconsSection, PageTreeIcons" />
  </configSections>
  <pageTreeIcons>
    <handlers>
      <add name="IconProperty" type="PageTreeIcons.TreeIconHandlers.IconPropertyHandler,PageTreeIcons" />
      <add name="LinkType" type="PageTreeIcons.TreeIconHandlers.PageLinkTypeHandler,PageTreeIcons" />
      <add name="PageType" type="PageTreeIcons.TreeIconHandlers.PageTypeHandler,PageTreeIcons" />
      <add name="PageReference" type="PageTreeIcons.TreeIconHandlers.PageReferenceHandler,PageTreeIcons" />
      <add name="Property" type="PageTreeIcons.TreeIconHandlers.PropertyHandler,PageTreeIcons" />
    </handlers>
    <mappings>
      <add key="Feeds" handler="PageType" pageTypeId="10" icon="~/Images/PageTreeIcons/Feed.gif" />
      <add key="IconProperty" handler="IconProperty" propertyName="PageTreeIcon" toolTipPropertyName="PageTreeIconToolTip" />
      <add key="MissingKeywords" handler="Property" iconType="Status" propertyName="Keywords" empty="true" icon="~/Images/PageTreeIcons/warning.gif" toolTip="/pagetreeicons/property/missingkeywords" />
      <add key="ShortCut" handler="LinkType" iconType="Status" linkType="Shortcut" icon="~/Images/PageTreeIcons/Shortcut.gif" toolTip="/pagetreeicons/pagelinktype/statusshortcut" />
      <add key="External" handler="LinkType" iconType="Status" linkType="External" icon="~/Images/PageTreeIcons/External.gif" tooltip="/pagetreeicons/pagelinktype/statusexternal" />
      <add key="FetchData" handler="LinkType" iconType="Status" linkType="FetchData" icon="~/Images/PageTreeIcons/FetchData.gif" tooltip="/pagetreeicons/pagelinktype/statusfetchdata" />
      <add key="Search" handler="PageReference" pageLink="10" icon="~/Images/PageTreeIcons/search.gif" />
    </mappings>
  </pageTreeIcons>
</configuration>