attachmentGalleryPicker

Last modified by Lucas Charpentier on 2026/10/27 10:26

Audit

Macro ID
attachmentGalleryPicker
Source
XS
Type
Generator
Classification reason

Status
Reviewed
Criteria version
15.20
XWiki version
18.8.0
Audit date
2026-10-16
Auditor
Compared macros
attachmentSelector documentTree

Sources

Where to gather the information the criteria are checked against, see Gather the sources.

SourceWhat it givesUsed forWhere
DocumentationParameters, default values and examples, including the most common exampleL2, L3, and the criteria measured with the most common examplehttps://www.xwiki.org/xwiki/bin/view/documentation/xs/dev/attachments/attachmentgallerypicker-macro/
Source codeHow the macro declares its parameters and content: types, groups, features, advanced and hidden flags, constraints, content type, inline supportC4, C5, C7, C8, C9, C13, E4, E6https://github.com/xwiki/xwiki-platform/blob/xwiki-platform-18.8.0/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/src/main/java/org/xwiki/attachment/picker/internal/AttachmentGalleryPickerMacro.java
Macro descriptorWhat the Edit Macro dialog is built from, on design.xwiki.orgD1, D2, C1 to C9, E4Descriptor, list of macros with their categories
TranslationsThe name, description and parameter names in each languageD1, D2, D4, C1l10n.xwiki.org
Uses in XWiki pagesHow XWiki itself uses the macro, a realistic example when the documentation has noneL3, C2, C3, C6, C8, C9Search the xwiki organization on GitHub
Compared macrosThe audits of the macros of the same typeL1, D3attachmentSelector, documentTree
Other sources specific to this macro
CriterionResultNotes
D1 wordingKOminor: "Attachment Picker" uses plain words, but the macro is a developer building block: inserted in a page on its own, it shows a search field and a grid of attachments, and picking one only sends a JavaScript event, it inserts or links nothing. A user who types "attachment" to add an attachment to the page gets it second in Quick Actions, after Attachment Selector, another developer widget: no entry that adds an attachment comes before them, for "attachment" or "attach"; only "upload" gives the Image entry first.
D2 summaryKO"Grid based attachment picker." repeats the name and does not say what the macro adds to the page: a search field with Current Page and All Pages scopes and a grid of attachments to pick from, meant to be wired to an application by JavaScript. To reproduce: open the Insert Macro dialog and select Attachment Picker.
D3 categoryOKthe macro is in the Development category, like attachmentSelector, the other attachment widget for applications, which fits a macro whose selection is only usable from a script. documentTree is in Navigation, which does not apply here.
D4 quick-actionKOQuick Actions finds the macro first for "attachmentGalleryPicker", "Attachment Picker" and the French name "Sélecteur de pièces jointes", and second for the synonym "attachment", after Attachment Selector. The synonyms "file", "file picker", "image picker" and "select attachment" give no result.
L1 consistencyOKcompared with attachmentSelector and documentTree. Like documentTree, no parameter is mandatory, there is no content, and the Quick Action inserts the macro right away, with no dialog. attachmentSelector opens the dialog, since its classname and property are mandatory: it writes the choice into an object property, which the picker does not, so the difference is by design.
L2 doc-parametersOKthe new documentation lists the four parameters, none mandatory, with the default 20 of limit. It gives no default for filter, which the descriptor declares as an empty list, the same meaning, and the current page for target, which is what an empty target does.
L3 doc-exampleOKthe most common example is {{attachmentGalleryPicker id="illustration" filter="image/*"/}} , the "Pick an Image" example of the documentation, closest to the only use in XWiki Standard, the attachment tab of the image dialog, {{attachmentGalleryPicker filter="image/*" target="..."/}} . Every example of the documentation renders without error.
I1 patternOKcompared with children, the reference generator: both are inserted by their Quick Action without a dialog, and through the Insert Macro dialog with an Edit Macro dialog whose fields are all optional.
I2 zero-configOKQuick Actions and the Edit Macro dialog submitted with the default values insert {{attachmentGalleryPicker/}} . View mode shows the search field, with the Current Page scope selected, and "No result." in a warning box on a page without attachments, which explains the empty result. The editor shows only the "macro:attachmentGalleryPicker" placeholder, see E1.
I3 instantN/A
I4 cursorN/A
I5 focusOKthe macro has no mandatory parameter, and its four fields are visible without scrolling, with the focus on the first one, Filter.
E1 wysiwygKOthe editor shows only the generic "macro:attachmentGalleryPicker" placeholder, while view mode shows the search field, the Current Page and All Pages buttons and the grid of attachments: the grid is built by JavaScript that does not run in the editor. To reproduce: insert {{attachmentGalleryPicker id="illustration" filter="image/*"/}} , see XWIKI-23036.
E2 errorsKOinvalid values are accepted silently or give a message that does not name the parameter. {{attachmentGalleryPicker limit="abc"/}} and {{attachmentGalleryPicker limit="0"/}} show 20 attachments, {{attachmentGalleryPicker limit="-3"/}} shows an empty picker and the notification "The attachments search query failed.", {{attachmentGalleryPicker filter="pictures"/}} shows "No result." in both scopes, and {{attachmentGalleryPicker target="NoSuch.Page"/}} shows "No result." for the current page, with no message about the page.
E3 nestingKOin a list item and in a table cell, like * {{attachmentGalleryPicker id="illustration" filter="image/*"/}} , the macro is inline and renders "The [attachmentGalleryPicker] macro is a standalone macro and it cannot be used inline." in the editor and in view mode. In a box it works.
E4 inline-supportOKthe macro declares no inline support, and its output is a block widget, a search field above a grid of previews, which cannot be inside a sentence. The documentation says so.
E5 emptyN/A
E6 inplaceN/A

Parameters

ParameterC1 clarityC2 mandatoryC3 defaultsC4 input-assistanceC5 groupsC6 orderC7 alternativesC8 advancedC9 technicalC13 constraintsNotes
filterOKOKKOKOOKOKN/AOKOKKO

C1: "mimetypes" is a technical term, OK since the macro targets developers, and the description gives an example of the expected value.

C3, minor: the field opens empty, which means every attachment, while the most common example, and the only use in XWiki Standard, sets image/*. Neither the field nor the description says that an empty filter keeps every type.

C4: a plain text field for a comma separated list of media types, where a select of common types with several values, like Images or PDF, could be used. For example, typing "pictures" is accepted and gives "No result.".

C13, minor: the list of media types declares no format, so the dialog accepts any text, like "pictures".

idKOOKOKOKOKOKN/AOKOKN/A

C1: "The id of the attachment picker macro" does not say what the id is for: it is set as the HTML id of the rendered element, so that a script can reach the picker and listen to its selection events, which only the documentation says.

limitOKOKOKKOOKOKN/AOKOKKO

C4: a plain text field for a number of attachments, where a number field could be used. For example, typing "abc" is accepted and shows 20 attachments.

C13: limit is an Integer with no declared range, so the dialog accepts 0 and negative values: {{attachmentGalleryPicker limit="-3"/}} shows an empty picker and "The attachments search query failed.".

targetKOOKOKOKOKOKN/AOKOKOK

C1: the name is the parameter ID, "target", capitalized by the dialog, and neither the name nor the description has a translation key, so the French and German dialogs show "Target" and the English description. "The reference to the document serving as the current document" does not say that it decides which page the Current Page scope searches and which selections show the warning. To reproduce: open the Edit Macro dialog in French.

C3: no default is declared, but the field opens empty, which means the current page, the value of the most common example.

C4: a page picker, which finds "Sandbox" when typing it.

C13: the page picker builds a valid reference, so the dialog does not need to reject a typed value.

Other notes

Other notes: the macro is a developer building block, documented under the developer documentation, but it is neither hidden nor in the Internal category, so every user sees it in Quick Actions and the Insert Macro dialog, where inserting it alone gives a picker whose selection is lost. The audit treats it as a developer macro, as its category says.

KOs and tickets

Every KO needs a ticket covering it, see Report the KOs. One ticket can cover several KOs. Known issues filed for this macro are suggested in italics: link them as existing tickets when they cover the KO.

KOCriterionExisting ticketsNew tickets
D1D1 wordingXWIKI-25473
D2D2 summaryXWIKI-25473
D4D4 quick-actionXWIKI-25444
E1E1 wysiwygXWIKI-23036 (partial)XWIKI-25523 (partial), XWIKI-25524
E2E2 errorsXCOMMONS-3847 (partial), XRENDERING-823 (partial), XWIKI-25581 (partial)
E3E3 nestingXWIKI-23501
C3:filterC3 defaults, filterXWIKI-23759
C4:filterC4 input-assistance, filterXWIKI-23045 (partial)XWIKI-25499
C13:filterC13 constraints, filterXWIKI-25509
C1:idC1 clarity, idXWIKI-25473
C4:limitC4 input-assistance, limitXWIKI-25182
C13:limitC13 constraints, limitXWIKI-25182
C1:targetC1 clarity, targetXWIKI-6061 (partial)XWIKI-25473
Success

Every KO is covered by a ticket.

Tickets

TicketOriginKOs coveredKOs partly covered
XWIKI-23036ExistingE1
XWIKI-23501ExistingE3
XWIKI-23759ExistingC3:filter
XWIKI-25182ExistingC13:limit C4:limit
XWIKI-6061ExistingC1:target
XCOMMONS-3847NewE2
XRENDERING-823NewE2
XWIKI-25444NewD4
XWIKI-25473NewC1:id D1 D2 C1:target
XWIKI-23045ExistingC4:filter
XWIKI-25499NewC4:filter
XWIKI-25509NewC13:filter
XWIKI-25523NewE1
XWIKI-25524NewE1
XWIKI-25581NewE2

Known issues of this macro

IssueTitleStatusCriteria
XWIKI-23036AttachmentGalleryPicker macro WYSIWYG: The buttons in the picker should not be interactable in edit modeOpenE1

68 more known issues affect every macro: see the Known issues.

Get Connected