My Macro:
## @noparams
<div id="related-content">
<script language=javascript>
function toogle(divname) {
if (document.getElementById(divname).style.display != "block") { document.getElementById(divname).style.display = "block"; }
else { document.getElementById(divname).style.display = "none"; }
}
</script>
#if($content.getIdAsString()!='4161541')
#set($wiki="")
#set($globalHelper=$action.getHelper())
#if($content) ## i. e. we render a normal page
#set($renderer=$globalHelper.getWikiStyleRenderer())
#set($context=$content.toPageContext())
#set($labelList=$content.getGlobalLabels($action.getRemoteUser()))
#if($labelList.size() > 0)
#set($labelUtil=$content.getLabelUtil())
#set($labels=$labelUtil.convertToDelimitedString($labelList))
#set($labels="'"+$labels+"'")
#set($labels=$labels.replace(" ","','"))
<h1><a href="javascript:;" onclick="toogle('rcontent');">Sider med lignende indhold</a></h1>
<br>
<div id="rcontent" name="rcontent" style="display:block;">
<ac:structured-macro ac:macro-id="e5bbc54f-287e-447c-9e9e-f84af88ad353" ac:name="contentbylabel" ac:schema-version="2">
<ac:parameter ac:name="showLabels">false</ac:parameter>
<ac:parameter ac:name="cql">label in ($labels) AND label != "noshow"</ac:parameter>
</ac:structured-macro>
</div>
#end
#end
#end
</div>
Is not working in C7, seems $content.getLabelUtil() is deprecated.... https://confluence.atlassian.com/doc/deprecated-code-paths-removed-in-7-0-967879993.html
Ok, what do I do? Ad get whats possible with $content ? All I find is C6.6 related
Hello, @Normann P_ Nielsen _Netic_ !
I understand that is can be quite troubling when something is deprecated or completely removed from an array of tools that we are accustomed to using.
The content.getLabelUtil() method has been deprecated in a previous version of Confluence. Confluence 5.2, to be more precise. Here you can check this information:
Here is a screenshot of that page:
According to the deprecation notice, we should start using LabelUtil directly. Here is a link to it:
If you need further assistance with developing questions, you can reach to our Developer Community, Normann. Here, take a look!
Let us hear from you!
As in: #set($labels=$content.LabelUtil().convertToDelimitedString($labelList)) ?
That does not work ...
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.
Long time ago - my current code is:
## @noparams
<div id="related-content">
<script language=javascript>
function toogle(divname) {
if (document.getElementById(divname).style.display != "block") { document.getElementById(divname).style.display = "block"; }
else { document.getElementById(divname).style.display = "none"; }
}
</script>
#if($content.getIdAsString()!='4161541')
#set($wiki="")
#set($globalHelper=$action.getHelper())
#if($content) ## i. e. we render a normal page
#set($renderer=$globalHelper.getWikiStyleRenderer())
#set($context=$content.toPageContext())
#set($labelList=$content.getGlobalLabels($action.getRemoteUser()))
#if($labelList.size() > 0)
#set($labels="")
#foreach( $label in $labelList )
#if($labels == '')
#set($labels="'"+$label+"'")
#else
#set($labels=$labels+","+"'"+$label+"'")
#end
#end
#set($labels=$labels.replace(" ","','"))
<h1><a href="javascript:;" onclick="toogle('rcontent');">Sider med lignende indhold</a></h1>
<br>
<div id="rcontent" name="rcontent" style="display:block;">
<ac:structured-macro ac:macro-id="e5bbc54f-287e-447c-9e9e-f84af88ad353" ac:name="contentbylabel" ac:schema-version="2">
<ac:parameter ac:name="showLabels">false</ac:parameter>
<ac:parameter ac:name="cql">label in ($labels) AND label != "noshow"</ac:parameter>
</ac:structured-macro>
</div>
#end
#end
#end
</div>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Normann P_ Nielsen _Netic_ . I was looking so hard at utilizing the actual method that totally overlooked the option to just iterate thru the list. What can I say, works for me!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.