Theme extension points

By using the Eclipse Extension Point Framework, themes provide various points where theme functionality can be extended by simply putting a new JAR file in the classpath.


Including an extension point in a theme

The tags in the <portal-theme-ext> TLD are provided for processing theme extension points. The following code provides a simple example of an extension point included in a theme:

<%-- Declares extension point ID that you want to retrieve attached extensions for --%>
	<portal-theme-ext:themeExtension id="com.ibm.portal.theme.plugin.SimpleLinks" >		
		<%-- loop over active extensions, if any --%>
		<portal-theme-ext:themeExtensionLoop>
		<%-- Use extension properties to add content to the page --%>	
		<a href="<portal-theme-ext:themeExtensionItemUrl />" >
		<portal-fmt:title varname=
     '<%=(com.ibm.portal.theme.plugin.ThemeItem)themeExtension%>' /></a>
	</portal-theme-ext:themeExtensionLoop>				
</portal-theme-ext:themeExtension>

Refer to the descriptions in Tags used by the portal JSPs for more information about the theme extension tags and their usage options. Refer to the Javadoc information for the Themes public API as the <portal-theme-ext> tags will only work with those interfaces.


Use existing extension points in the included Portal theme

The included Portal theme provides extension points that allow limited customization without editing the theme JSPs. Use the following guidelines to do this:

  1. Implement the required interface, for example, com.ibm.portal.theme.plugin.ThemeLinkItem.

  2. Create a plugin.xml file declaring the extension.

  3. Create the necessary JAR file.

  4. Put the JAR file in a directory that is on the classpath of the Portal application. It is recommended that you create a new directory to separate custom code from the base code. This directory can be created in the was_profile_root directory.

  5. Update the classpath for the JAR file from the WAS Administrative console by editing an existing shared library and adding an entry for ${USER_INSTALL_ROOT}/<directory_with_new_JAR>. For details refer to the WAS documentation.

  6. Restart the server and extension should now be visible in the theme.

For more information on plugin.xml files or the extension framework, refer to the Eclipse Extension Point Framework documentation. The Javadoc information for the Theme public API also contains coding and plugin.xml samples.


Default extension points

The table below describes the extension points included in the Portal theme. The ID field is the extension point identifier used in the plugin.xml. The Default Implementation field describes the interface which provides the information the default extension point requires. Type enforcement is not performed at run time.

ID Description Default Implementation
com.ibm.portal.theme.plugin.MetaTagDataItems  provides components with a method of adding data to the meta tags of a page  {@link DefaultThemeTextItem}
com.ibm.portal.theme.plugin.Styles  provides components with a method of contributing CSS styles to the page (either a link or embedded css)  {@link DefaultThemeTextItem}
com.ibm.portal.theme.plugin.JavascriptItems  provides components with a method of adding javascript to a page (either a link or actual js code)  {@link DefaultThemeTextItem}
com.ibm.portal.theme.plugin.HorizontalPageBarItems  provides components with a method of adding jsp content to the horizontal page bar {@link DefaultThemeJspInclude} 
com.ibm.portal.theme.plugin.VerticalPageBarItems provides components with a method of adding jsp content to the vertical page bar  {@link DefaultThemeJspInclude}
com.ibm.portal.theme.plugin.PageContextMenuItems  provides components with a method of adding an item to the page menu  {@link DefaultThemeLinkItem} 
com.ibm.portal.theme.plugin.PortletContextMenuItems provides components with a method of adding an item to the portlet menu  {@link DefaultThemeLinkItem}
com.ibm.portal.theme.plugin.Flyouts  provides components with a method of adding a flyout to the page  {@link DefaultThemeJspInclude}

The Page Builder theme includes extension points for adding items to page menus and portlet menus and for including aggregators with the page when using Active Site Analytics. Following are the extension point identifiers for these default extension points:

For background information on the Active Site Analytics extension point, refer to the Instrumenting a theme for Active Site Analytics and Injecting custom aggregators topics.


Parent

Layout of the portal page


Related tasks


Inject custom aggregators
Instrument a theme for Active Site Analytics

 


+

Search Tips   |   Advanced Search