The $field variable does contain the properties based on this:
https://www.xwiki.org/xwiki/bin/view/FAQ/Bindings%20available%20inside%20the%20Custom%20Display%20property
I was successful to retrieve properties like
$field.name
$field.prettyName
$field.Type
but was unable to identify the property to determine the size of the control (“size” in the UI).
Is this property available in the “$filed” object and if, what would the name be?
Thank you
Hi,
See https://xwiki.org/xwiki/bin/view/Documentation/DevGuide/Scripting/APIGuide/#HAccessobjectsinapage
You can test by writing the following in your custom display field:
{{velocity}}
#foreach ($prop in $field.getProperties())
* $prop.name - $prop.value
#end
{{/velocity}}
And you’ll see that the way to get the size is thus: $field.getProperty('size').value
Thx
Perfect, thank you very much!
Since some of the properties of $field (like name and prettyName) are accessible directly, I didn’t consider this.
Yes, it seems we don’t have specific direct apis for all property metadata.