Hello,
im currently loosing my mind for at least two to three hours.
I simply want to get the pretty name of a property via velocity. However I can’t find a function for that.
Base:
#set ($xdoc=$xwiki.getDocument('XWiki.MyOwnTemplate'))
#set ($xobject = $xdoc.getObject('XWiki.MyOwnClass'))
#set ($xclass = $xobject.xWikiClass)
#set ($discard = $doc.use($xobject))
When using:
#foreach ($property in $xclass.properties)
$property.Name
$property.PrettyName
#end
I get both the Name (XWP_NAME) and the PrettyName (XWP_PRETTYNAME) of every property that the class have.
What I need however is a function to get the PrettyName of a Property. And where I start to loose my mind is this example:
$xobject.getProperty('a_Name').Name
works and responds as expected with:
a_Name
However:
$xobject.getProperty('a_Name').PrettyName
responds with:
$xobject.getProperty(‘a_Name’).PrettyName
What I need it for:
I have a larger script and inside I have an array of the property names (without references!!! It is just “coincidentally” exactly the property names) and with foreach through that Array I want to get the Pretty Names of the corresponding property in the xclass.
As the term / description “pretty name” is used so often inside XWiki, using google will throw like every result, but not once have I found something that was helping yet.
I really don’t want to build something and check each individual non referenced property name for its matching property name within #foreach ($property in $xclass.properties)
as this don’t seem like an “clean” solution to me.
Is there any function, something like $xclass.getPrettyName(“insert Property Name here”) ?