Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Conditionally add tabs to page properties based on templates

Avatar

Avatar
Validate 1
Level 1
akaria
Level 1

Like

1 like

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
Boost 1
View profile

Avatar
Validate 1
Level 1
akaria
Level 1

Like

1 like

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
Boost 1
View profile
akaria
Level 1

02-03-2021

Hi everyone,

Is it possible to add customized tabs to page properties (in Sites console) based on templates?

  • We are currently modernizing 'old' static templates to 'new' editable templates
  • AEM version is 6.5.0
  • Using Touch UI

For example:

  • Create a new page named 'page1' with template 'A'
  • Create a new page named 'page2' with template 'B'
  • Create a new page named 'page3' with template 'C'
  • Page properties of 'page1' show customized tabs specific to template 'A', along with default tabs from the page component (basic, advanced, thumbnail, etc)
  • Page properties of 'page2' show only default tabs
  • Page properties of 'page3' show customized tabs specific to template 'C'

Is it possible to implement this?

 

If it's possible, where should we place the nodes for the customized tabs?
Do we need to create a certain template type for this?

Thanks in advance 🙂

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
Suraj_Kamdi
MVP

Likes

142 likes

Total Posts

156 posts

Correct Reply

41 solutions
Top badges earned
Springboard
Validate 1
Establish
Contributor
Ignite 3
View profile

Avatar
Springboard
MVP
Suraj_Kamdi
MVP

Likes

142 likes

Total Posts

156 posts

Correct Reply

41 solutions
Top badges earned
Springboard
Validate 1
Establish
Contributor
Ignite 3
View profile
Suraj_Kamdi
MVP

02-03-2021

Yes, we can @akaria .

1. create a template-specific component and provide resourceSuperType as the main page component. 

2. inside a template-specific component create separate page properties cq:dialog based on your requirement.

3. now next part go to the respective template structure inside /conf directory 

   ex. 

    a. /conf/<project-name>/settings/wcm/templates/sample-template/initial/jcr:content  and set resourceType as template specific component path 

   b. same applies for /conf/<project-name>/settings/wcm/templates/sample-template/structure/jcr:content.

 

Note: do not create any additional files inside template specific component other than page-properties dialog (cq:dialog)

 

Hope this will help.

 

Please let me know if you need more help on this.

 

 

Answers (3)

Answers (3)

Avatar

Avatar
Affirm 50
MVP
Vaibhavi
MVP

Likes

192 likes

Total Posts

166 posts

Correct Reply

53 solutions
Top badges earned
Affirm 50
Validate 1
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Affirm 50
MVP
Vaibhavi
MVP

Likes

192 likes

Total Posts

166 posts

Correct Reply

53 solutions
Top badges earned
Affirm 50
Validate 1
Ignite 1
Give Back 5
Give Back 3
View profile
Vaibhavi
MVP

02-03-2021

Hi @akaria , 

It is possible with custom implementation with hide/show the tabs. But you need an identifier to choose while creating the page as it is a single template and page properties has to behave differently with page creation.  

One of the custom solution would be

1. Create a template with page property dialog has all the possible option. 

2. Customize the page creation widget where you provide an option to choose the behavior. (For ex: if you have 3 different behaviour for pageA B and C, provide some dropdown to choose the behavior while creating the page) 

3. Depending upon the value selected from step2(you can set the identifier based on values) hide the unwanted tabs and show the required once. 

 

Hope this helps

 

Avatar

Avatar
Boost 3
Level 1
Subbu_WCM
Level 1

Likes

3 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile

Avatar
Boost 3
Level 1
Subbu_WCM
Level 1

Likes

3 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile
Subbu_WCM
Level 1

02-03-2021

Hi @akaria 

you can use the granite render condition.

<tab1>
    <items></items>
    <granite:rendercondition  
          jcr:primaryType="nt:unstructured"  
         sling:resourceType="<project>/components/graniteConditions/hide-tab"  
         templates="[/conf/<project>/settings/wcm/templates/<template2>" />
</tab1>
<tab2>
    <items></items>
    <granite:rendercondition  
          jcr:primaryType="nt:unstructured"  
         sling:resourceType="<project>/components/graniteConditions/hide-tab"  
         templates="[/conf/<project>/settings/wcm/templates/<template1>" />
</tab2>



in your project  create hide-tab.html (<project>/components/graniteConditions/hide-tab/hide-tab.html) and call sling modal with Sling request adaptable. In the sling modal you check the template of page is listed in the templates property or not.Based that you can set the render condition attribute for the request. You can get the page path from the request query string

 slingHttpServletRequest.setAttribute(RenderCondition.class.getName(), new SimpleRenderCondition(true/false));




Avatar

Avatar
Coach
Employee
jbrar
Employee

Likes

380 likes

Total Posts

868 posts

Correct Reply

283 solutions
Top badges earned
Coach
Establish
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Coach
Employee
jbrar
Employee

Likes

380 likes

Total Posts

868 posts

Correct Reply

283 solutions
Top badges earned
Coach
Establish
Give Back 50
Give Back 5
Give Back 3
View profile
jbrar
Employee

02-03-2021

You can also look into Granite show/hide functionality that allows show/hide of content based on properties: https://experienceleague.adobe.com/docs/experience-manager-65/developing/components/hide-conditions....