Changes for page Tag Cloud

Last modified by Tobias Wintrich on 2024/06/27 08:20

From version 1.1
edited by Tobias Wintrich
on 2023/03/27 11:19
Change comment: Install extension [org.xwiki.platform:xwiki-platform-tag-ui/15.1]
To version 3.1
edited by Tobias Wintrich
on 2024/06/27 08:20
Change comment: Install extension [org.xwiki.platform:xwiki-platform-tag-ui/16.4.0]

Summary

Details

XWiki.RequiredRightClass[0]
level
... ... @@ -1,0 +1,1 @@
1 +edit
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -4,6 +4,9 @@
4 4  #set ($tagCloudSpace = $xcontext.macro.params.get('space'))
5 5  #set ($tagCloudSpaces = $xcontext.macro.params.get('spaces'))
6 6  #set ($limit = $xcontext.macro.params.get('limit'))
7 +#if ("$!limit" != '' && $limit < 0)
8 + #set ($limit = 0)
9 +#end
7 7  ##
8 8  ## Configurable popularity levels. You must enter an even number of levels. Default: 6.
9 9  #set ($popularityLevels = ["notPopular", "notVeryPopular", "somewhatPopular", "popular", "veryPopular", "ultraPopular"])
... ... @@ -39,7 +39,7 @@
39 39  ## If tags have the same occurrence, limit them in alphabetical order
40 40  #set ($tagCountListSorted = $collectiontool.sort($tagCountList, ['count:desc', 'name']))
41 41  #if ("$!limit" != '')
42 - #set ($tagCountListSorted = $tagCountListSorted.subList(0, $limit))
45 + #set ($tagCountListSorted = $tagCountListSorted.subList(0, $mathtool.min($tagCountListSorted.size(), $limit)))
43 43  #end
44 44  ##
45 45  ## Only build popularity map if at least one tag exists