Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-14057

Add ability to execute velocity on UIX parameters at registration time

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 8.4.4
    • UI Extension
    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: