1

I am creating a menu component. Mouting a tree with the pages and its children.

<ul class="topnav" data-sly-list.child="${currentPage.listChildren}">

It's working fine, but I need to replace the currentPage using a property of my dialog component.

How can I do this?

I already have the dialog component and I'm able to retrieve the property value.

enter image description here

I don't wanna use java classes, I am assuming that there's a way to do this using only htl

Italo Pessoa
  • 179
  • 1
  • 12
  • I can understand why you want to stick to HTL only solution but not using POJO classes to model this (business) requirement of yours will be a hacked solution. I strongly recommend not following this path. Just an advise – Imran Saeed Mar 31 '17 at 07:51

1 Answers1

2

There is no shorthand for getting a Page specified by a path, mostly because HTL sits lower than the WCM layer in AEM.

You can find an example of how to do this using the Use-API (JS, but it's similar in Java) at https://github.com/Adobe-Marketing-Cloud/aem-htl-repl/blob/master/content-pkg/jcr_root/apps/repl/components/repl/template.html and https://github.com/Adobe-Marketing-Cloud/aem-htl-repl/blob/master/content-pkg/jcr_root/apps/repl/components/repl/logic.js

Vlad
  • 10,602
  • 2
  • 36
  • 38
  • I'm running some tests based on the code you suggested. – Italo Pessoa Mar 30 '17 at 19:25
  • It worked, but not exactly as I expected. When I change to design_dialog, the component (I don't know how/why) can't get the property value. But the simple dialog works fine for me – Italo Pessoa Mar 31 '17 at 14:08