Adding attachment functionality into your custom module is fairly easy thanks to the built in features in Zurmo. Follow the three step process outlined below:
1. Add a field in the module model
In the module model in getDefaultMetadata function, add a relation to the File Model and specify the element to use.
2. Add the “files” field to the view
In the Edit and Detail Views, the field name (“files”) is not specified in the view, only “Files” type. This is because we are taking advantage of derived attribute types, similar to “DateTimeCreatedUser”.
3. Update Default Controller of the module.
Since you can attach multiple files, you need to update the controller to be able to handle multiple files on post. Add the following functions to the Default Controller of the custom module: