The file parameter accepts an URL as value, besides an attachment name. So if we're going to use the attachment picker we need to make sure we can still set an URL (e.g. by allowing "free" values).
Then, setting the parameter type to org.xwiki.model.reference.AttachmentReference with the object editor is a first step. It would allow the user to easily select an attachment, but it wouldn't limit the suggestions to PDF attachments, which is what we want. For this we need to follow what has been done for the Office Viewer macro:
create a PDFResourceReference Java type similar to OfficeResourceReference. For this we need a new (Java) module in the macro-pdfviewer.
set the type of the file PDF macro parameter to PDFResourceReference
in the newly created Java module, add a template to control how the PDFResourceReference parameters are displayed, following what we did for OfficeResourceReference.
modify the POM of the wiki module to depend on the Java module, using an optional dependency for now.
We need to be careful that support for binding a picker to a macro parameter type is available since 10.11 I think. So we probably need to edit the PDF Viewer macro on a recent version of XWiki, set the parameter type, export as XAR, add to source tree, apply xar:format, drop unneeded stuff, build for 9.11 and check if we can import.
Comment from @ldubost : It seems "org.xwiki.model.reference.AttachmentReference" needs to be added to the field definition.
The text was updated successfully, but these errors were encountered: