Parameterized Namespace Granite Include

Available since version 4.5.0

Purpose

The parameterized namespace include (acs-commons/granite/ui/components/include) can include dialog snippets with a namespace and or parameters.

The namespace mechanism is similar to the following following deprecated feature.

This allows you to reuse a dialog snippet multiple times in a dialog.

The parameters mechanism allows you to define parameters in your dialog snippets in the values. For example the fieldLabel. You can define a default value, but override the default value when including the snippet.

Examples

  • Namespacing: Simple but full example for demonstrating the namespacing with a dialog, Sling Model and HTL

  • Parameters: Example of parameters used to include a snippet

Configuration

The namespaced properties can be configured using the OSGI configuration. This allows you define extra properties to be automatically namespaced. By default the values are name, fileNameParameter and fileReferenceParameter.

So if we need to have ‘myCustomProperty’ namespaced:

com.adobe.acs.commons.granite.ui.components.impl.include.NamespacedTransformedResourceProviderImpl.xml

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    properties="[name,fileNameParameter,fileReferenceParameter,myCustomProperty]"
    jcr:primaryType="sling:OsgiConfig"/>