Wiki Macro Fields

Last modified by Eleni Cojocariu on 2026/10/12 15:27

Reference

A wiki macro is described by two XClasses: XWiki.WikiMacroClass, which declares the macro itself, and XWiki.WikiMacroParameterClass, which declares one of its parameters. This page lists every field of both, under the name the object editor shows.

To see these fields filled in, follow Write a Macro in a Wiki Page.

Macro fields

The fields of XWiki.WikiMacroClass, in the order the object editor lists them.

FieldValuesDefaultWhat it does
Macro idtext(none)The id callers type to invoke the macro, as in {{hello/}}.
Macro nametext(none)The name displayed in the editor's macro picker.
Macro descriptiontext(none)A short description, displayed in the editor next to the name.
Default categoriesone or more categories(none)The categories the macro is listed under in the macro picker. The field suggests the categories the wiki knows, listed in Macro Categories.
Supports inline modeYes, NoNoWhether the macro can be used in an inline context, such as inside a sentence.
Macro visibilityCurrent User, Current Wiki, Global(none)Who can use the macro, and which rights its author needs. See Wiki Macros.
Macro content availabilityOptional, Mandatory, No content(none)Whether the macro accepts a body.
Macro content typeUnknown, Wiki, or a Java typeUnknownHow the body is handled: Wiki parses it as wiki content, Unknown passes it as plain text, and a Java type such as java.util.List<java.lang.String> converts it. Leaving the field empty is the same as Unknown.
Content descriptiontext(none)A short description of the body, displayed in the editor. It does not apply when the content availability is No content.
Macro codewiki content(none)The content evaluated every time the macro runs. Write it in the same syntax as the page that holds it.
Priorityinteger1000The execution order relative to the other macros: the lowest value runs first.
Isolated ExecutionYes, NoNoXWiki 17.3.0+, 16.10.9+ Set it when the execution of the macro does not modify the XDOM, including through the macros it executes. Reading the XDOM, and reading or writing other context information, still counts as isolated. Marking a macro isolated speeds its execution up.
Content order propertyinteger(none)XWiki 17.5.0+ Where the body is displayed in the macro configuration UI. A lower value comes first, and -1 means no value. It is computed together with the parameter order.
Asynchronous renderingYes, NoNoWhether the macro result is rendered asynchronously.
CachedYes, NoNoWhether the result of an execution is cached.
Context elementsone or more context entries(none)The context information the macro needs while it executes, such as the current user or the current document. It is also what the cache key is built from.

Parameter fields

The fields of XWiki.WikiMacroParameterClass. Add one object per parameter.

FieldValuesDefaultWhat it does
Parameter nametext(none)The name callers use when they pass the parameter.
Parameter descriptiontext(none)A short description, displayed in the editor.
Parameter mandatoryYes, NoNoWhen a mandatory parameter is missing, the macro fails to execute.
Parameter default valuetext(none)The value used when the caller leaves the parameter empty.
Parameter typeUnknown, Wiki, or a Java typeUnknownWhich Java type the value is converted to: Wiki for wiki content, Unknown for plain text, or a type such as java.util.List<java.lang.String>. The type also decides which widget the editor shows, see Macro Parameter Pickers, and the {{wikimacroparameter}} macro needs it to know how to render the value.
Parameter featuretext(none)The feature this parameter is bound to. Parameters sharing a feature are a choice, see below.
Parameter group propertytext, several allowed(none)The group this parameter belongs to. Parameters of one group are displayed together, see below.
Parameter hiddenYes, NoNoSet it to hide the parameter from the macro configuration UI. A hidden parameter is still displayed when it has a value.
Parameter advancedYes, NoNoWhether the parameter is emphasized in the macro configuration UI.
Parameter deprecatedYes, NoNoMarks a parameter that should no longer be used.
Parameter feature mandatoryYes, NoNoThe parameter itself can stay optional while its feature is mandatory, meaning at least one parameter of that feature has to be used.
Parameter order propertyinteger(none)XWiki 17.5.0+ Where the parameter is displayed in the macro configuration UI. A lower value comes first, and -1 means no value. It is computed together with the content order.

Features and groups

The two fields organize the parameters of a macro, and they do different things:

  • a feature is a choice: the parameters bound to the same feature are mutually exclusive, and a caller uses one of them;
  • a group is a set: the parameters of one group serve the same need, are displayed together, and can be combined.

The two can be mixed. A macro that takes a reference either as a URL or as an internal representation, which is a string plus the type of that string, declares three parameters:

ParameterFeatureGroup
urlreference(none)
internalRepresentationreferenceinternalrepresentation
internalRepresentationTypereferenceinternalrepresentation

The group is what makes the last two travel together as one side of the choice. "Parameter feature mandatory" then states that one side has to be used, even though each parameter is optional on its own.

FAQ

What does an empty type field mean?

Unknown, which is the default of both "Macro content type" and "Parameter type". The value is then passed on as plain text.

Why does my parameter not appear in the macro editor?

Check "Parameter hidden", which removes it from the macro configuration UI, and "Parameter order property", which may have pushed it to the end of the form.

Related

Get Connected