Expand my Community achievements bar.

SOLVED

Default change in properties

Avatar

Level 2

Hi, I am using AEM 6.5 and i want to check the Hide in Navigation in default properties of page by default in all the pages from the code side can someone help me with that?

tatrived_0-1694604196505.png

 

1 Accepted Solution

Avatar

Correct answer by
Level 9

It seems you've created a proxy page component by extending a core page component. In this scenario, the "Hide in Navigation" option is not selected by default. I'm a bit unclear what you want to achieve here. Could you please clarify what you are trying to achieve or explain your goal differently?

However, if you want to have the "Hide in Navigation" option selected by default in page properties, you should create a cq:dialog within your proxy component. In the dialog, you can set the default value for the "hideinnav" property as follows: 

<hideinnav jcr:primaryType="nt:unstructured"
  sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
  name="./hideInNav"
  renderReadOnly="{Boolean}true"
  text="Hide in Navigation"
  uncheckedValue="{Boolean}false"
  checked="{Boolean}true"
  value="{Boolean}true">
  <granite:data jcr:primaryType="nt:unstructured"
    allowBulkEdit="{Boolean}true"
    cq-msm-lockable="hideInNav"/>
</hideinnav>

You can refer to the link for more details on how to customise the dialog in Page Properties.
https://experienceleague.adobe.com/docs/experience-manager-64/developing/extending-aem/page-properti... 

 

 

View solution in original post

3 Replies

Avatar

Correct answer by
Level 9

It seems you've created a proxy page component by extending a core page component. In this scenario, the "Hide in Navigation" option is not selected by default. I'm a bit unclear what you want to achieve here. Could you please clarify what you are trying to achieve or explain your goal differently?

However, if you want to have the "Hide in Navigation" option selected by default in page properties, you should create a cq:dialog within your proxy component. In the dialog, you can set the default value for the "hideinnav" property as follows: 

<hideinnav jcr:primaryType="nt:unstructured"
  sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
  name="./hideInNav"
  renderReadOnly="{Boolean}true"
  text="Hide in Navigation"
  uncheckedValue="{Boolean}false"
  checked="{Boolean}true"
  value="{Boolean}true">
  <granite:data jcr:primaryType="nt:unstructured"
    allowBulkEdit="{Boolean}true"
    cq-msm-lockable="hideInNav"/>
</hideinnav>

You can refer to the link for more details on how to customise the dialog in Page Properties.
https://experienceleague.adobe.com/docs/experience-manager-64/developing/extending-aem/page-properti... 

 

 

Avatar

Community Advisor

@tatrived it all depends on what u want todo, if your idea is to show checkbox checked and get property persisted, then either write a script kind to persist/save that property in all pages, if it is only for new pages or going fwd or with manual intervention, go with @Mahedi_Sabuj proposed,

 

If the requirement is to use this value in sling model or any other code, use default value annotations or getwithdefault

https://sling.apache.org/documentation/bundles/models.html

https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/org/apache/sling/api/...

 

Avatar

Administrator

@tatrived  Do you find the suggestions from users useful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. 



Kautuk Sahni