Ordering of wiki macro parameters

Hi everyone,

as part of the proposal for being able to provide order for macro parameters, there’s also the need to be able to provide order in Wiki Macro parameters.

There’s two options for defining the order in wiki macro parameter, and I’d like to know your opinion about which option feel best to you.

First option is to add a new dedicated field in WikiMacroParameterClass to specify the order. Second option is to rely on the xobjects number to specify the order.

Option 1 - Pro:

  • Easy to implement
  • Easy to discover for users
  • We will need the order also for the content field

Option 1 - Cons:

  • Might be seen as redundant with the xobject number

Option 2 - Pro:

  • No need to add a new field
  • “What you see is what you get”, i.e. when you create a new macro you add the parameters in the order you want to display them (more or less since it depends also on their properties advanced etc and it doesn’t take into account the order of content)

Option 2 - Cons:

  • There’s currently no possibility in the xobject editor to move an xobject: we need that improvment anyway, but it’s some work for implementation
  • Suddenly all defined wikimacro will have their parameters ordered given the xobject number, which might be surprising. But this could be mitigated by the fact that even with Option 1 with the change of the algorithm for ordering parameters users might be a bit surprised after the upgrade.

Personally I think I have a slight preference for Option 1, because I find it more discoverable for users and probably also because it’s easier to implement, and it’s more consistent with the need to order the content too.

wdyt?

1 Like

Note that if we go for option 1 I’ll have enough time to implement it for 17.5.0 but if we go for option 2 then I probably won’t have time to implement ordering of xobjects for 17.5.0.

PR opened with the changes for first option: XWIKI-22803: Enable the ability to order macro parameters defined in XWiki objects directly from the UI by surli · Pull Request #4213 · xwiki/xwiki-platform · GitHub

  • More consistent with the Java version

I think Option 1 is a good idea and should be implemented. That being said, I feel that two parameters which have the same order value should ideally be ordered based on the xobject natural order by default (it’s there, so let’s use it when we don’t have anything else).

Note that I’m already falling back on the parameter name in such case, as for the java parameters.