Pages Taglib - Component Tags

Pages Component Tags (cpp)

The tags for rendering the HTML code of a content component are the subject of this tag description page. The tags to implement editing UI components such as dialogs are described in Pages Editing Tags.

Some component rendering tags are declaring a model variable like the 'component' tag of the general Nodes tag library (see: 'component' tag in the General Tags); the model attributes are:

  • var
    the name of the model variable; this name must be unique in the chosen scope
  • type
    the full class name of the models Java class
  • scope
    the scope of the declared variable (page, request, session)
  • replace
    if 'true' an existing value of the same type is replaced by a new instance otherwise an existing instance of the chosen type is reused

Some component rendering tags are using a set of general attributes to support component styling:

  • cssBase
    this attribute declares the 'cssBase' variable value and overwrites the default 'cssBase' value derived from the components resource type (see: Component Styling); the CSS class declared as 'cssBase' is rendered as the 'main' CSS class of the HTML code rendered by a tag of this taglib
  • cssAdd
    this attribute declares additional CSS classes for the HTML rendered by a tag of the taglib; these classes are added to the 'main' class declared as 'cssBase'
  • cssSet
    this attribute specifies the 'main' class of the HTML tag to render; it overwrites the implicit used 'cssBase' main class, the 'cssBase' variable is declared furthermore and can be used but is not rendered as a tags CSS class if 'cssSet' is specified

head

The PageBodyTag creates the HTML body tag and the EDIT elements around the page content.

body

The PageBodyTag creates the HTML body tag and the EDIT elements around the page content.

Attributes

  • tagId
    String
    optional

    the optional element id for the BODY DOM element

  • cssBase
    String
    optional
    default: derived from the resource type

    specifies the 'cssBase' value and overwrites the default value derived from the component resource type

  • cssSet
    String
    optional

    the 'main' CSS class for the produced tag (hides the 'cssBase' class)

  • cssAdd
    String
    optional

    additional CSS classes added to the 'main' CSS class specified by the 'cssBase' or 'cssSet' attribute

defineObjects

The extended define objects tag.

Examples

  • <cpp:defineObjects/>

    • pagesAccessAuthor , pagesAccessPreview , pagesAccessPublic : boolean variables that are true if the request runs in access mode author / preview / public , respectively.
    • pagesModeNone, pagesModePreview, pagesModeEdit, pagesModeDevelop : boolean variables that are true if the request runs in display mode none, preview, edit or develop, respectively. 

token

The tag to render a token request (image).

Attributes

  • test
    java.lang.Object
    optional

    nothing is rendered if the test attribute value is "false' (general condition)

include

Extends the sling:include Tag options.

Attributes

  • flush
    java.lang.Boolean
    optional

    Whether to flush the output before including the target

  • path
    String
    optional

    The path to the resource object to include in the current request processing. If this path is relative it is appended to the path of the current resource whose script is including the given resource. Either resource or path must be specified. If both are specified, the resource takes precedences.

  • resourceType
    String
    optional

    The resource type of a resource to include. If the resource to be included is specified with the path attribute, which cannot be resolved to a resource, the tag may create a synthetic resource object out of the path and this resource type. If the resource type is set the path must be the exact path to a resource object. That is, adding parameters, selectors and extensions to the path is not supported if the resource type is set.

  • resource
    org.apache.sling.api.resource.Resource
    optional

    The resource object to include in the current request processing. Either resource or path must be specified. If both are specified, the resource takes precedences.

  • addSelectors
    String
    optional

    Works like addSelectors from sling:include

  • replaceSelectors
    String
    optional

    Works like replaceSelectors from sling:include

  • replaceSuffix
    String
    optional

    Works like replaceSuffix from sling:include

  • var
    String
    optional

    the name of the model variable; this name must be unique in the chosen scope

  • scope
    String
    optional

    The scope in which the variable is stored: page (= default), request or session .

  • dynamic
    java.lang.Boolean
    optional

    Whether to force dynamic include as a separate request depending on the server settings. Handle with care: on SSI include, some parameters are not effective anymore.

  • mode
    String
    optional

    the optional display mode for the include (Pages editing mode), or "request" to take the mode from the request itself (to reset overrides).

  • subtype
    String
    optional

    an optional subtype to include editing components of a component

  • test
    java.lang.Object
    optional

    include only if the result of this test expression is 'true' (boolean)

dropZone

A tag to declare a drop zone to change a property by dropping an asset or component (edit mode only).

Attributes

  • tagName
    String
    optional

    the name of the HTML tag; default: 'div'

  • resource
    org.apache.sling.api.resource.Resource
    optional

    the resource to modify (default is the resoiurce of the enclosing 'element')

  • resourcePath
    String
    optional

    the path of the resource to modify (alternative to the 'resource' attribute)

  • property
    String
    optional

    the path (name) of the property relative to the resource

  • i18n
    java.lang.Boolean
    optional

    use localized property path if 'true'

  • filter
    String
    optional

    the filter key set to determine an appropriate drag operation

  • successEvent
    String
    optional

    the event key of the event to trigger after a successful change request

  • mode
    String
    optional

    the optional display mode for the include (Pages editing mode), or "request" to take the mode from the request itself (to reset overrides).

  • cssBase
    String
    optional

    specifies the 'cssBase' value and overwrites the default value derived from the component resource type

  • cssSet
    String
    optional

    the 'main' CSS class for the produced tag (hides the 'cssBase' class)

  • cssAdd
    String
    optional

    additional CSS classes added to the 'main' CSS class specified by the 'cssBase' or 'cssSet' attribute

container

the tag to render a Pages Sling container

Attributes

  • var
    String
    optional

    the name of the model variable; this name must be unique in the chosen scope

  • type
    String
    optional

    the full class name of the models Java class

  • scope
    String
    optional

    The scope in which the variable is stored: page (= default), request or session .

  • replace
    java.lang.Boolean
    optional

    if 'true' an existing value of the same type is replaced by a new instance otherwise an existing instance of the chosen type is reused

  • test
    java.lang.Object
    optional

    nothing is rendered if the test attribute value is "false' (general condition)

  • mode
    String
    optional

    The edit mode for this render step and all included components

  • decoration
    java.lang.Boolean
    optional

    If false, the decoration div will not be written.

  • tagId
    String
    optional

    the optional DOM tree id for the HTML tag

  • tagName
    String
    optional

    the tag name to render the wrapping tag (default: 'div')

  • cssBase
    String
    optional

    specifies the 'cssBase' value and overwrites the default value derived from the component resource type

  • cssSet
    String
    optional

    the 'main' CSS class for the produced tag (hides the 'cssBase' class)

  • cssAdd
    String
    optional

    additional CSS classes added to the 'main' CSS class specified by the 'cssBase' or 'cssSet' attribute

  • tagAttributes
    String
    optional

    a string of tag attributes embedded 'as is' in the rendered HTML tag; this is useful if tag attributes are calculated by the model implementation and used in the tag which declares the model instance variable - with the @{...} JSP-EL expression declaration such a set of dynamic tag attributes can be embedded

element

the tag to render a Pages Sling element

Attributes

  • var
    String
    optional

    the name of the model variable; this name must be unique in the chosen scope

  • type
    String
    optional

    the full class name of the models Java class

  • scope
    String
    optional

    The scope in which the variable is stored: page (= default), request or session .

  • replace
    java.lang.Boolean
    optional

    if 'true' an existing value of the same type is replaced by a new instance otherwise an existing instance of the chosen type is reused

  • test
    java.lang.Object
    optional

    nothing is rendered if the test attribute value is "false' (general condition)

  • mode
    String
    optional

    The edit mode for this render step and all included components

  • tagId
    String
    optional

    the optional DOM tree id for the HTML tag

  • tagName
    String
    optional

    the tag name to render the wrapping tag (default: 'div')

  • cssBase
    String
    optional

    specifies the 'cssBase' value and overwrites the default value derived from the component resource type

  • cssSet
    String
    optional

    the 'main' CSS class for the produced tag (hides the 'cssBase' class)

  • cssAdd
    String
    optional

    additional CSS classes added to the 'main' CSS class specified by the 'cssBase' or 'cssSet' attribute

  • tagAttributes
    String
    optional

    a string of tag attributes embedded 'as is' in the rendered HTML tag; this is useful if tag attributes are calculated by the model implementation and used in the tag which declares the model instance variable - with the @{...} JSP-EL expression declaration such a set of dynamic tag attributes can be embedded

model

A tag to instantiate a model object.

Attributes

  • var
    String
    optional

    the name of the model variable; this name must be unique in the chosen scope

  • type
    String
    optional

    the full class name of the models Java class

  • scope
    String
    optional

    The scope in which the variable is stored: page (= default), request or session .

  • replace
    java.lang.Boolean
    optional

    if 'true' an existing value of the same type is replaced by a new instance otherwise an existing instance of the chosen type is reused

  • path
    String
    optional

    The resource path to create the model from, if it isn't the currently rendered resource.

  • resource
    org.apache.sling.api.resource.Resource
    optional

    The resource to create the model from. if it isn't the currently rendered resource.

  • cssBase
    String
    optional

    specifies the 'cssBase' value and overwrites the default value derived from the component resource type

  • test
    java.lang.Object
    optional

    nothing is rendered if the test attribute value is "false' (general condition)

property

A tag to instantiate a property model object.

Attributes

  • var
    String
    optional

    the name of the model variable; this name must be unique in the chosen scope

  • type
    String
    optional

    the full class name of the models Java class

  • scope
    String
    optional

    The scope in which the variable is stored: page (= default), request or session .

  • replace
    java.lang.Boolean
    optional

    if 'true' an existing value of the same type is replaced by a new instance otherwise an existing instance of the chosen type is reused

  • property
    String
    optional

    The name of the property of the resource from which we create the model.

  • i18n
    java.lang.Boolean
    optional

    If true, i18n is observed - the model is instantiated from the i18nized property.

  • cssBase
    String
    optional

    specifies the 'cssBase' value and overwrites the default value derived from the component resource type