Add New Layer (Mode)
When you are editing a page, there are various modes available. These modes are implemented using layers. These allow access to differing types of functionality for the same page content. The standard layers are: edit, preview, annotate, developer, and targeting.
Layer Example: Live Copy Status
A standard AEM instance provides the MSM layer. This accesses data related to multisite management and highlights it in the layer.
To see it in action, you may edit any We.Retail language copy page (or any other live copy page) and select the Live Copy Status mode.
You can find the MSM layer definition (for reference) in:
/libs/wcm/msm/content/touch-ui/authoring/editor/js/msm.Layer.js
Code Sample
This is a sample package showing how to create a layer (mode), which is a new layer for MSM view.
CODE ON GITHUB
You can find the code of this page on GitHub
- Open aem-authoring-new-layer-mode project on GitHub
- Download the project as a ZIP file
Add New Selection Category to Asset Browser
The asset browser shows assets of various types/categories (for example, images and documents). The assets can also be filtered by these asset categories.
Code Sample
aem-authoring-extension-assetfinder-flickr
is a sample package showing how to add a group to the asset finder. This example connects to Flickr’s public stream and shows them in the side panel.
CODE ON GITHUB
You can find the code of this page on GitHub
- Open aem-authoring-extension-assetfinder-flickr project on GitHub
- Download the project as a ZIP file
Filtering Resources
When authoring pages, the user must often select from resources (for example, pages, components, and assets). This can take the form of a list, for example, from which the author must choose an item.
To keep the list to a reasonable size and also relevant to the use case, a filter can be implemented in the form of a custom predicate. For example, if the pathbrowser
Granite component is used to allow the user to select the path to a particular resource, the paths presented can be filtered in the following way:
- Implement the custom predicate by implementing
com.day.cq.commons.predicate.AbstractNodePredicate
interface. - Specify a name for the predicate, and refer that name when using the
pathbrowser
.
For further detail on creating a custom predicate, see Implementing a Custom Predicate Evaluator for the Query Builder.
com.day.cq.commons.predicate.AbstractNodePredicate
interface works in the classic UI as well.Add New Action to a Component Toolbar
Each component (usually) has a toolbar that provides access to a range of actions that can be taken on that component.
Code Sample
aem-authoring-extension-toolbar-screenshot
is a sample package showing how to create a custom toolbar action to render components.
CODE ON GITHUB
You can find the code of this page on GitHub
- Open aem-authoring-extension-toolbar-screenshot project on GitHub
- Download the project as a ZIP file