I have a component of resource type - granite/ui/components/foundation/form/pathbrowser , i need to make sure in case of internal link .html to be appended whereas in case of external link it should be as it is no .html appending. Can anyone help?
Solved! Go to Solution.
Views
Replies
Total Likes
In case of Touch UI, we need to make use of Java Code only, I was not able to find any other options.
This is the code which I tried and it worked for me.
Here I am checking for the 4 cases:
1. Checking for file extension:- so if the file extension is .mp4 or .mp3 like that then we are not processing the URL and simply returning it.to check the different extension we have created an enum class. like this.
case 2: if URL is null or empty then we are sending null.
case 3: if URL starts with "/content" then we are appending ".html"
case 4: if URL starts with "http" or "https" or "www" then we are simply sending back the URL without performing any operation as it is an external link.
Views
Replies
Total Likes
Once you get user input and before displaying it as a link, check if this is internal page or not. You can PageManger & Resource API for this.
ashish kumarm48760261 wrote...
I have a component of resource type - granite/ui/components/foundation/form/
pathbrowser , i need to make sure in case of internal link .html to be appended whereas in case of external link it should be as it isno . html appending. Can anyone help?
Views
Replies
Total Likes
Jitendra S.Tomar wrote...
Once you get user input and before displaying it as a link, check if this is internal page or not. You can PageManger & Resource API for this.
ashish kumarm48760261 wrote...
I have a component of resource type - granite/ui/components/foundation/form/pathbrowser , i need to make sure in case of internal link .html to be appended whereas in case of external link it should be as it is no .html appending. Can anyone help?
The whole point is to avoid doing backend code checks. The "linkpattern" config options for pathfield would enable us to handle it all by itself. Check the API here is the API snippet.
linkPattern : String
Defaults to '{0}.html' if parBrowse = true, otherwise simply '{0}'.
Writing an explict condition in the backend code to add .html is not required.
Views
Replies
Total Likes
Yeah but here i am working in Touch UI (granite/ui/components/foundation/form/pathbrowser ) for AEM 6.2 , so this property seems to be invalid for this case.
Views
Replies
Total Likes
Do we have an answer for this? How to configure this in touch UI pathbrowser?
Views
Replies
Total Likes
Hi,
Did you get an answer to it how it could be accomplished in touchui?
Views
Replies
Total Likes
In case of Touch UI, we need to make use of Java Code only, I was not able to find any other options.
This is the code which I tried and it worked for me.
Here I am checking for the 4 cases:
1. Checking for file extension:- so if the file extension is .mp4 or .mp3 like that then we are not processing the URL and simply returning it.to check the different extension we have created an enum class. like this.
case 2: if URL is null or empty then we are sending null.
case 3: if URL starts with "/content" then we are appending ".html"
case 4: if URL starts with "http" or "https" or "www" then we are simply sending back the URL without performing any operation as it is an external link.
Views
Replies
Total Likes
Views
Likes
Replies