Hi,
(how) is it possible to remove all labels of a page by macro?
Best regards
Stefan
Community moderators have prevented the ability to post new answers.
You can use the DefaultLabelManager (which implements the LabelManager class) to remove labels from a page. The LabelManager class is described here:
I'm pretty sure you can get a reference to it in a macro by doing something like this:
#set($containerManagerClass=$action.class.forName('com.atlassian.spring.container.ContainerManager')) #set($getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null)) #set($containerManager=$getInstanceMethod.invoke(null,null)) #set($containerContext=$containerManager.containerContext) #set($labelManager=$containerContext.getComponent('labelManager'))
(code borrowed from https://answers.atlassian.com/questions/25933/confluence-user-macro-popular-labels-with-new-label-filter-why-is-this-not-working-on-the-current-space)
hth,
matt
Thanks matt,
I've never used Velocity yet, so I need some hours to dive into it. Your snippet is very useful and I'll post my final macro (or a link to it) here after completion.
cheers
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.