Highlighted

AEM - Save a tag in a specific namespace

virginief244896

01-08-2018

Hello,

I want to save a new tag in a specific namespace from a tag picker.

I set a tagpicker, with allowCreate=true, mapped on a namespace (tagsPath property):

- When I open the tagbrowser, I can see the tag of the selected namespace

- But when I write a new tag in the tagpicker, it is created in the "Standard tag" namespace.

Is there a configuration or something to map the creation from the tagpicker directly in a specified namespace?

Thanks for your help.

Virginie

Replies

Highlighted

virginief244896

03-08-2018

Thanks for your information smacdonald2008 but I could not find the information in the doc topic.

It does not explain the tag creation from the tagpicker component, only from the tagging tool.

Highlighted

Ratna_Kumar

MVP

03-08-2018

Hi,

You can see the Adobe HELPX article on your use case: Adobe Experience Manager Help | Developing HTML Template Language Components that search for Adobe E... https://helpx.adobe.com/experience-manager/using/tagmanager-api-htl.html

The above article shows you that how to use Tag Manager API to search for the tags.

Also, the tagspicker resourceType doesn't let you create tags, its just let you pick them as shown in the above article. Please note that, you cannot create tags using tagpicker.

Hope this helps!!

Thanks,

Ratna Kumar.

Highlighted

virginief244896

03-08-2018

Hello Ratna Kumar,

You can create tag from the tagpicker with the property "allowCreate".

When I use a tagpicker with this property, it saves my tag on the node but :

- if I write a tag, it saves it inside the namespace default (=Standard tag)

- if I reproduce the tag with namespace behaviour (ex: brand:mytag), it saves it only on the node and not inside my namespace (brand)

I would like that when I create a tag from tagpicker, it save it inside my specific namespace.

Thanks,

Virginie

Highlighted

pratikr88081998

22-01-2019

1. The tagspicker(/libs/cq/gui/components/common/tagspicker) is depricated from 6.3, so we need to use the      tagfield(cq/gui/components/coral/common/form/tagfield) instead.

     This is the warning you get while looking into the tagspicker : Since 6.3. Please use                                                   /libs/cq/gui/components/coral/common/form/tagfield RT.

2. By default it creates a tag in standard tags and that too using the API :

     TagManager -> canCreateTagByTitle(String tagTitlePath, Locale locale)

     So we need to override the "cq/gui/components/coral/common/form/tagfield" and make below changes.

3. Edit the render.jsp and add /etc/designs/<namespaceYouNeed> on line : 106.

     This will enable the suggestions to be coming from the targeted namespace only.

     Put the identifier class in the line no : 128 to capture this field specific event in tagfield.js

4. Edit the "/apps/<yourProject>/common/structure/tagfield/clientlibs/tagfield/tagfield.js" and use      registry.register("foundation.validation.validator" -> selector -> (use the above Line 128 identifier from render.jsp) -> validate -> to      capture the event of the user defined tag application.

     We need to write a servlet once we receive the user defined tag. -> In this use tagmanager API to create a tag in specific      namespace. -> createTag(String tagID, String title, String description)

     After creation of tag make necessary changes in render.jsp as per the requirement on line :169 to make sure you repaint the      previously tagged tags when we reopen the properties after application of this new namespaced tag.

AEM - Save a tag in a specific namespace