Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
8.4.4
-
None
-
Unknown
-
Description
Right now UIX parameters can contain velocity content but the evaluation is done lazily, i.e. when the UIXP gets the parameters.
There are use cases when it's interesting to execute the velocity on some parameters when registering the UIX. For example imagine the "org.xwiki.platform.panels.Applications" UIXP and the following parameters for the Blog app:
label=$services.localization.render('xe.panels.quicklinks.blog') target=Blog.WebHome icon=icon:transmit
Now imagine that you copy the Blog application to another space (Blog2). You'll get 2 entries in the App Panel but both will point to Blog.WebHome. We would need that the one matching the copied blog to point to Blog2.WebHome.
Thus the "target" parameter could have the value:
target=${doc.space}.WebHome
but this would work only if the eval is done when registering the page.
An alternative would be to bind in the velocity context a new variable (say $uixdoc) which would represents the doc of the ui, and make sure this binding finds its way somehow in WikiUIExtensionParameters. But this may not potentially cover all use cases.