Diese Konversation wurde aufgrund von Inaktivität geschlossen. Bitte erstellen Sie einen neuen Post.
Level 1
Level 2
Melden Sie sich an, um alle Badges zu sehen
Diese Konversation wurde aufgrund von Inaktivität geschlossen. Bitte erstellen Sie einen neuen Post.
Hi Team,
I'm trying to create a component which has the resource type as
cq/gui/components/coral/common/form/tagfield
I want to retrive this component values on page like text filed. Is there a way to do this. Getting tag values from component not from page properties.
Gelöst! Gehe zu Lösung.
Zugriffe
Antworten
Likes gesamt
In your sling model you can use TagManager API to read tag values.
@SlingObject private ResourceResolver resourceResolver; @ValueMapValue private String tagName; //tag field name from your component dialog TagManager tagManager = resourceResolver.adaptTo(TagManager.class); Tag tag = tagManager.resolve(tagName); String tagTitle = tag.getTitle(); String tagId = tag.getId();
More details on TagManager API can be found in below javadoc.
In your sling model you can use TagManager API to read tag values.
@SlingObject private ResourceResolver resourceResolver; @ValueMapValue private String tagName; //tag field name from your component dialog TagManager tagManager = resourceResolver.adaptTo(TagManager.class); Tag tag = tagManager.resolve(tagName); String tagTitle = tag.getTitle(); String tagId = tag.getId();
More details on TagManager API can be found in below javadoc.
Do you want to read them from the component and display on the page as text ?
If that is the case which one do you want to display is it tagname or tagId ?
Can you explain more on this ?
Hi @Mani_kumar_ Thanks for your response. Yes I want to read tags through component and I just want to display only the name of the tag on page.
If that is the case as mentioned by @salamswapnil use Tagmanager API read name from the parsed Tag object it should solve your problem.
How to get tag from tagging. I want industry, sector and country tag name How I'll get, How I write sling model. @arunpatidar @BrianKasingli
Hi @iamsumansourav
@salamswapnil has already provided the code sample, to get tag name from tag id.
Zugriffe
Likes
Antworten
Zugriffe
Likes
Antworten
Zugriffe
Likes
Antworten