Closed LeviticusMaximus closed 2 years ago
cc @BoDonkey
Hi @LeviticusMaximus,
Sorry I missed this. At the moment you can elect to replace the entire fileGroups array through an option in the /modules/@apostrophecms/attachment/index.js
file. You can also alter the existing one from within that same file. Basically you would do something like this:
module.exports = {
init(self) {
const newGroup = {
name: 'localVideo',
label: 'apostrophe:localvideo',
extensions: [ 'mp4' ],
extensionMaps: {}
};
self.fileGroups = [ ...self.fileGroups, newGroup ];
}
};
So you are just adding the new group in place. Note, you need to add the extensionMaps
property with an empty object. I'm not sure why the module is glitching about this. I have to look closer at the logic in this module.
I'm implementing an easier way to do this using a fieldGroupsAdd
option. Might be out soon.
Cheers
Hi,
In the docs it states:
Can you give me a bit more information about how I would do this please? I would like to add an mp4 option. I guess that I could download the github @apostrophecms/attachment/index.js and create a local version in a new folder in modules/@apostrophecms/attachment and then add another fileGroup something like the following:
But I'm wondering if there's a simpler method that doesn't involve duplicating the whole index.js file?
Thanks