+

Search Tips   |   Advanced Search

Utility plug-ins

Utility plug-ins give us more control over how markup is inserted into the web content. For example, we can use comparisons to conditionally determine when to insert markup or we can add comments that can be viewed only by content authors.


Comment plug-in

Use the Comment plug-in to insert comments you want only content authors to view. All text written between the plug-in start and end tags is treated as comment. This text is not processed, but is omitted when the web content is rendered. Example:

[Plugin:Comment] This is a comment [/Plugin:Comment]


Equals plug-in

Use the Equals plug-in to insert markup into the web content only if the values of two text attributes match. The plug-in provides the two attributes text1 and text2. All markup between the start and end tags is rendered as part of your web content only if the values of these two attributes match.

The following sample renders the markup between the plug-in start and end tags only if the rendered content is currently in a workflow stage named Review.

[Plugin:Equals text1="Review" text2="[Property type='content' 
               context='current' field='currentstage']"] 
Document in review.
[/Plugin:Equals]


NotEquals plug-in

Use the NotEquals plug-in to insert markup into the web content only if the values of two text attributes do not match. The plug-in provides the two attributes text1 and text2. All markup between the start and end tags is rendered with the web content only if the values of these two attributes do not match.

The following sample renders the markup between the start and end tags only if thetype element of the rendered content does not have the value Internal:

[Plugin:NotEquals text1="Internal" text2="[Element type='content' 
                  context='current' key='type']"] 
Public document
[/Plugin:NotEquals]


Locale plug-in

Use the Locale plug-in to add locale information to the web content or to insert markup into the web content depending on the current locale. This plug-in determines the preferred supported locale in the current context.

The Locale plug-in uses the following attributes:

If the Locale plug-in specifies body content, the markup between the start and end tags is rendered only if the preferred supported locale is determined. If no supported locale applies in the current context, the Locale plug-in does not insert markup into content.

Examples:


Matches plug-in

Use the Matches plug-in to conditionally insert markup into the web content by evaluating a regular expression against a passed text value. The plug-in provides two attributes: text and pattern. All markup between the plug-in start and end tags is rendered only if the value of the text attribute matches the regular expression in the pattern attribute.

We can also have negative pattern matching. In this case, the markup of the body of the plug-in tag is rendered only if the text does not match the regular expression. To use negative pattern matching, set the negative-match attribute to true.

The regular expression dialect used by the plug-in is defined by the Java language class java.util.regex.Pattern.

Examples:


ThemeCapability plug-in

Use the ThemeCapability plug-in to retrieve the list of available theme capabilities of the page that is currently rendered. These capabilities are described in Basic artifacts and their relation. The plug-in returns the capabilities, in no specific order, as a string of name-value pairs that are separated by commas.

Here is an example of a string that is returned when the [Plugin:ThemeCapability] tag is rendered on a page that uses the full profile theme:

{analytics_aggregator=8.0, portal.livetext.hcard=8.0, widget_container=2.1, active_site_analytics=8.0, 
portal.livetext.action=8.0, open_ajax_hub=2.0, dojo=1.7, mashups.enabler=3.0.0.1, content_mapping.picker=8.0, 
cp_tagging_rating=8.0, oneUI=3.0.1, portal.livetext.adr=8.0, mashups.builder=3.0.0.1, 
federated_documents.picker=8.0, portal.livetext.c2a=8.0}

We can use the Matches plug-in to check for the availability of specific theme capabilities and then dynamically add markup to the rendered content. The following sample adds a string (... Dojo is available ...) to the markup only if the dojo theme capability is available in the current rendering context:

[Plugin:Matches text="[Plugin:ThemeCapability]" pattern=".*dojo=.*"] 
... Dojo is available ...
[/Plugin:Matches]


ToolbarState plug-in

Use the ToolbarState plug-in to retrieve the state of the site toolbar that is provided with the Portal 8.0 theme. The plug-in renders the following strings to indicate the current state of the toolbar:

Example:

[Plugin:ToolbarState]

We can use the Equals plug-in to check for the current state of the toolbar and then dynamically add markup to the rendered content. The following sample adds a component (web content templates/edit) to the markup only if the site toolbar is currently expanded:

[Plugin:Equals text1="open" text2="[Plugin:ToolbarState]"]
    [Component name="web content templates/edit"]
[/Plugin:Equals]


Parent: Render plug-ins provided with Web Content Manager

Related:

Basic artifacts and their relation

Related:

Accept-Language header in RFC2616 specification