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
Solved! Go to Solution.
Views
Replies
Total Likes
Thank you Scott. Yes, that's the option I mentioned earlier, to develop a new component. It seems 'a lot' of work for, at first sight, a simple requirement. I was trying to figure out any simplest way to do it, without implementing a whole new component. It would be great if we could use some functions in Granite XML definition files, beyond the granite:* mentioned in the documentation. Maybe in future releases Engineering could implement that.
Anyway, thank you very much again!
Kind regards,
Julio.
Views
Replies
Total Likes
Hi
Please have a look at this community article :- http://experience-aem.blogspot.in/2015/05/aem-6-sp2-handling-custom-protocol-in-link-href-in-rte.htm...
// AEM 6 SP2 - Handling Custom Protocol in Link Href in Rich Text Editor
I hope this would help you.
~kautuk
Views
Replies
Total Likes
Thank you for the comment, kautuk, but I don't think it's related with the exposed issue.
Kind regards,
Julio.
Views
Replies
Total Likes
A powerful way to do things in Touch UI component dialog - when the OOTB functionality is not what you want, is to write a custom sling:resourceType for use in the dialog.
Its basically a JQuery plug-in you want to use. So using this technique, you can meet your requirements (similiar to a custom xtype for Classic UI).
http://scottsdigitalcommunity.blogspot.ca/2017/02/creating-custom-experience-manager.html
(in this artilce - we use a color picker as an example - but you will get the idea)
Views
Replies
Total Likes
Thank you Scott. Yes, that's the option I mentioned earlier, to develop a new component. It seems 'a lot' of work for, at first sight, a simple requirement. I was trying to figure out any simplest way to do it, without implementing a whole new component. It would be great if we could use some functions in Granite XML definition files, beyond the granite:* mentioned in the documentation. Maybe in future releases Engineering could implement that.
Anyway, thank you very much again!
Kind regards,
Julio.
Views
Replies
Total Likes