Class CmsTemplatePlugin


  • public class CmsTemplatePlugin
    extends java.lang.Object
    Bean representing a template plugin.

    Template plugins are links to external resources which are categorized into named groups and provided either by formatters of elements in the current page, or by the current sitemap configuration. They can be programmatically accessed by group name from the template. They also have an order attribute to control the order in which they wil be returned (plugins will be sorted by descending order).

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String N_ATTRIBUTE
      Attribute node name.
      static java.lang.String N_GROUP
      Content value node name.
      static java.lang.String N_KEY
      Key node name.
      static java.lang.String N_ORDER
      Content value node name.
      static java.lang.String N_TARGET
      XML node name.
      static java.lang.String N_VALUE
      Value node name.
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsTemplatePlugin​(CmsLinkInfo target, java.lang.String group, int order, java.lang.String origin, java.util.Map<java.lang.String,​java.lang.String> attributes)
      Creates a new instance.
    • Constructor Detail

      • CmsTemplatePlugin

        public CmsTemplatePlugin​(CmsLinkInfo target,
                                 java.lang.String group,
                                 int order,
                                 java.lang.String origin,
                                 java.util.Map<java.lang.String,​java.lang.String> attributes)
        Creates a new instance.
        Parameters:
        target - the plugin target
        group - the plugin group
        order - the plugin order
        origin - the origin from which the plugin was read (for debugging)
        attributes - the attribute map
    • Method Detail

      • parsePlugins

        public static java.util.List<CmsTemplatePluginparsePlugins​(CmsObject cms,
                                                                     I_CmsXmlContentLocation parent,
                                                                     java.lang.String subName)
        Parses the template plugins.
        Parameters:
        cms - the CMS context
        parent - the parent location under which the template plugins are located
        subName - the node name for the template plugins
        Returns:
        the list of parsed template plugins
      • getAttributes

        public java.util.Map<java.lang.String,​java.lang.String> getAttributes()
        Gets the configured attributes of the plugin.
        Returns:
        the plugin attributes
      • getGroup

        public java.lang.String getGroup()
        Gets the plugin group.
        Returns:
        the plugin group
      • getOrder

        public int getOrder()
        Returns the plugin order.

        Plugins are sorted by descending order when retrieved in the template.

        Returns:
        the plugin order
      • getOrigin

        public java.lang.String getOrigin()
        The plugin origin, for debugging purposes.
        Returns:
        the plugin origin
      • getTarget

        public CmsLinkInfo getTarget()
        Gets the plugin target.

        When the plugins for a given group are retrieved, duplicate targets will be removed, and the position of each target in the resulting list is decided by the highest order for that target.

        Returns:
        the target
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()