Expand my Community achievements bar.

AEM - Save a tag in a specific namespace

Avatar

Level 1

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

6 Replies

Avatar

Level 10

I'll go ahead an move this to our Adobe Experience Manager​ community.

Avatar

Level 10

Information about tags and administrating them - including namespaces - is located in this AEM doc topic - Administering Tags

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.

Avatar

Level 10

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.

Avatar

Level 1

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

Avatar

Level 1

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