Extending Existing Components and Dialogs
Depending on the component you want to implement, it might be possible to extend or customize an existing instance, rather than defining and developing the entire structure from scratch.
When extending or customizing an existing component or dialog, you can copy or replicate either the entire structure or the structure required for the dialog before making your changes.
Extending an Existing Component
Extending an existing component can be achieved with Resource Type Hierarchy and the related inheritance mechanisms.
/apps
must define the entire overlay.Customizing a Existing Component Dialog
It is also possible to override a component dialog using the Sling Resource Merger and defining the property sling:resourceSuperType
.
This means you only need to redefine the required differences, as opposed to redefining the entire dialog (using sling:resourceSuperType
). This is now recommended method for extending a component dialog
See the Sling Resource Merger for more details.
Defining the Markup
Your component will be rendered with HTML. Your component needs to define the HTML needed to take the required content and then render it as required, on both the author and publish environments.
Using the HTML Template Language
The HTML Templating Language (HTL), introduced with AEM 6.0, takes the place of JSP (JavaServer Pages) as the preferred and recommended server-side template system for HTML. For web developers who need to build robust enterprise websites, HTL helps to achieve increased security and development efficiency.
Developing the Content Logic
This optional logic selects and/or computes the content to be rendered. It is invoked from HTL expressions with the appropriate Use-API pattern.
The mechanism to separate logic from appearance helps clarify what is called for a given view. It also allows differing logic for different views of the same resource.
Using Java
The HTL Java Use-API enables a HTL file to access helper methods in a custom Java class. This lets you use Java code to implement the logic for selecting and configuring the component content.
Using JavaScript
The HTL JavaScript Use-API enables a HTL file to access helper code written in JavaScript. This lets you use JavaScript code to implement the logic for selecting and configuring the component content.
Using Client-Side HTML Libraries
Modern websites rely heavily on client-side processing driven by complex JavaScript and CSS code. Organizing and optimizing the serving of this code can be a complicated issue.
To help deal with this issue, AEM provides Client-side Library Folders, which let you store your client-side code in the repository, organize it into categories and define when and how each category of code is to be served to the client. The client-side library system then takes care of producing the correct links in your final web page to load the correct code.
Read Using Client-Side HTML Libraries for more information.
Configuring the Edit Behavior
You can configure the edit behavior of a component including attributes such as actions available for the component, characteristics of the inplace editor, and the listeners related to events on the component. The configuration is common to both the touch-enabled and classic UI, albeit with certain, specific differences.
The edit behavior of a component is configured by adding a cq:editConfig
node of type cq:EditConfig
below the component node (of type cq:Component
) and by adding specific properties and child nodes.
Configuring the Preview Behavior
The WCM Mode cookie is set when switching to Preview mode even when the page is not refreshed.
For components with a rendering that are sensitive to the WCM Mode, they need to be defined to refresh themselves specifically, then rely on the value of the cookie.
Creating and Configuring a Dialog
Dialogs are used to allow author to interact with the component. Using a dialog allows authors and/or administrators to edit content, configure the component or define design parameters (using a Design Dialog)
Coral UI and Granite UI
Coral UI and Granite UI define the modern look and feel of AEM.
Granite UI provides a large range of the basic components (widgets) needed to create your dialog on the authoring environment. When necessary you can extend this selection and create your own widget.
For full details see:
-
Coral UI
- Provides a consistent UI across all cloud solutions
- Concepts of the AEM Touch-Enabled UI - Coral UI
- Coral UI Guide
-
Granite UI
- Provides Coral UI markup wrapped into Sling components for building UI consoles and dialogs
- Concepts of the AEM Touch-Enabled UI - Granite UI
- Granite UI Documentation