Registering Custom Asset Types
Enabling custom asset types for listing in AEMForms Portal
Make sure you have AEM 6.3 with SP1 and the corresponding AEM Forms Add On Installed. This feature only works with AEM Forms 6.3 SP1 and above
Specify Base Path
The base path is the top level repository path that comprises all the assets that a user may want to list in the search & lister component. If desired, the user may also configure specific locations within the base path from component edit dialog, so that the search is triggered on specific locations rather than searching all the nodes within the base path. By default, the base path is used as the search path criteria for fetching the assets unless the user configures a set of specific paths from within this location. It is important to have an optimal value of this path in order to make a performant search. The default value of base path will remain as /content/dam/formsanddocuments because all AEM Forms assets reside in /content/dam/formsanddocuments.
Steps to configure the base path
- Login to crx
- Navigate to /libs/fd/fp/extensions/querybuilder/basepath
- Click on "Overlay Node" in the toolbar
- Make sure the overlay location is "/apps/"
- Click Ok
- Click Save
- Navigate to the new structure created at /apps/fd/fp/extensions/querybuilder/basepath
- Change the value of the path property to "/content/dam"
- Click Save
By specifying the path property to "/content/dam" you are basically setting Base Path to /content/dam. This can be verified by opening the Search and Lister component.
Register custom asset types
We have added a new tab(Asset Listing) in the search and lister component. This tab will list out of the box asset types and additional asset types that you configure. By default, the following asset types are listed
- Adaptive Forms
- Form Templates
- PDF Forms
- Document(Static PDFs)
Steps to register custom asset type
- Create overlay node of /libs/fd/fp/extensions/querybuilder/assettypes
- Set the overlay location to "/apps"
- Navigate to the new structure created at **/apps/fd/fp/extensions/querybuilder/assettypes **
- Under this location, create an 'nt:unstructured' node for the type to be registered, name the node mp4files. Add the following two properties to this mp4files node
- Add jcr:title property to specify the display name of the asset type. Set the value of jcr:title to "Mp4 Files".
- Add "type" property and set its value to "videos". This is the value we use in our template to list assets of the type videos. Save your changes.
- Create a node of type "nt:unstructured" under mp4files. Name this node "searchcriteria"
- Add one or more filters under search criteria. Suppose, if the user wants to have a search filter to list mp4Files whose mime type is "video/mp4" you can do so here
- Create a node of type "nt:unstructured" under the node searchcriteria. Name this node "filetypes"
- Add the following 2 properties to this "filetypes" node
- name: ./jcr:content/metadata/dc:format
- value: video/mp4
- This means assets having the property dc:format equal to video/mp4 will be considered an asset type "Mp4 Videos". You can use any property listed on the "jcr:content/metadata" node for the search criteria
- Make sure to save your work
After performing the above steps, the new asset type(Mp4 Files) will start showing up in the asset types drop-down list of the Search and Lister component as shown below
If you have problems in getting this to work, you can import the following package. The package has two custom asset types defined. Mp4 Files and Worddocuments. Suggest you take a look at the /apps/fd/fp/extensions/querybuilder/assettypes
Install the customeportal package . This package contains sample portal page. This page will be used in part2 of this tutorial