+

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

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:


Equals plug-in

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.


NotEquals plug-in

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 the type element of the rendered content does not have the value Internal:


ifNotEmpty plug-in

Instart markup if value is not empty For example:


Locale plug-in

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:

acceptLanguage

Enables us to define one or more preferred locales that can be selected by the portal in a specific context. Attribute values must conform to the syntax specification of the Accept-Language header field of the HTTP/1.1 protocol. For details on this header field, see the Accept-Language section of the RFC2616 specification.

If the acceptLanguage attribute is not defined, the portal considers all available supported locales as equally acceptable when determining the preferred supported locale for the selected context.

pattern

Enables us to define the output format for the locale that is printed by the Locale plug-in.

Attribute values specify a pattern that can include the following placeholders:

  • {language}: Placeholder for the lowercase, two-letter language code of a locale as defined by the ISO-639 standard.

  • {country}: Placeholder for the uppercase, two-letter country code of a locale as defined by the ISO-3166 standard.

  • {variant}: Placeholder for the vendor-specific or browser-specific variant of a locale.

If the pattern attribute is not defined, the following pattern is used: {language}-{country}-{variant}.

printLocale

Enables us to define whether the preferred supported locale that is determined by the Locale plug-in is inserted into the web content. The attribute can have the following values:

  • true: The preferred supported locale is written to the markup of the page.

  • false: The preferred supported locale is not written to the markup of the page.

By combining this attribute with the acceptLanguage attribute, users can define content to be rendered only in the following circumstances:

  • If a specific locale is applicable in the current context

  • If one locale of a specific set of locales is applicable in the current context

Although the body of the Plugin tag is printed if an acceptable locale is supported, the preferred supported locale is not displayed when this attribute is set to false.

If the printLocale attribute is not defined, a value of true is used.

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

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 returned when the [Plugin:ThemeCapability] tag is rendered on a page that uses the full profile theme:

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:


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]

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:


Parent: Render plug-ins provided with Web Content Manager

Related:

Tags
Basic artifacts and their relation
Accept-Language header in RFC2616 specification