This blog is an extension to show/hide page properties for multiple templates from my ex-colleague Ahmed Musallam’s post How to show/hide page properties based on a single template path.
In AEM , editable templates usually share the same page component, which means the same page properties dialog.
Below are the steps to show/hide page properties based on the template paths.
- Create a servlet
2. Now you can add a granite:rendercondition node under any of your properties to show/hide them based on template path. Here is an example:
Following render condition shows the whole tab for templates matching /conf/mysite/settings/wcm/templates/field2-page or /conf/mysite/settings/wcm/templates/template1
Section1 properties (field1, another field) will be shown for template matching /conf/mysite/settings/wcm/templates/template1
Section2 properties (field2 will be shown for template matching /conf/mysite/settings/wcm/templates/template2
granite renderceondition for a section only allows elements to be visible for templates defined in for allowedPaths property. allowedPaths is multifield, any number of templates can be added to this property.
With the custom code and render condition you may be able to define multiple template paths on which you want to show the custom properties.