TouchUI Dialog - Hyperlink with custom href
Hi masters!
I’m building a TouchUI component dialog, and I’m trying to add a ‘hyperlink’ Granite component (granite/ui/components/foundation/hyperlink). I would like to set the href of the hyperlink to something based on the suffix (a substring of the suffix).
I’ve tried to use JSTL substring function (although the documentation [1] is explicit ‘Only the variables and functions given in this document are supported’, I had to check it J). This is what I’ve tried:
<column jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container"> <items jcr:primaryType="nt:unstructured"> <mylink jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/hyperlink" href="https://forums.adobe.com/assets.html/content/dam/something/${fn:substring(requestPathInfo.suffix,5,10)}" icon="icon-imageText" target="_blank" text="text"/> </items> </column>
…but it doesn’t work, as expected, because ‘Uncaught SlingException javax.el.ELException: Function 'fn:substring' not found’.
Is there a way to do this?
Maybe an alternative would be to develop a new component which would handle with the substring logic and would include the hyperlink Granite component with the correct href, but I would like to find the easiest and most elegant way to implement this.
Any suggestions would be appreciated.
Kind regards,
Julio.
AEM 6.2 SP1 CFP2