I'm looking to add a list of custom licenses in the file picker, as discussed in this post: https://moodle.org/mod/forum/discuss.php?d=206212
I'd like to create a local plugin for this, but unsure of the best way to approach this and would certainly appreciate any pointers.
Here's what I've done so far:
- Local development environment (Vagrant) is set up
- Code checker and PHPDoc plugins are installed
2. Reviewed https://docs.moodle.org/dev/Local_plugins
- it's not clear to me which files are required and which are optional
- unsure of which file I would use to build this functionality - settings.php, maybe?
3. Installed and reviewed similar plugin https://moodle.org/plugins/local_listcoursefiles
- it's close, but I need for the plugin to handle the addition of the license
I think I still have a lot more reading ahead of me, but was hoping you might be able to help get me going in the right direction.
I don't know much about this specific thing - I've never added a custom licence - but a couple of the questions I can answer:
- The only required files in a local plugin are version.php and lang/en/PLUGINNAME.php (the top two in https://docs.moodle.org/dev/Plugin_files). Depending on the version of Moodle you're developing on you might need an empty lib.php to stop it complaining / breaking. The only string definition you strictly need in the language file is: $string['pluginname'] = 'Whatever you want to call your plugin';
- The code from Rex Lorenzo's post in the discussion you link to looks like it's intended to be put into db/upgrade.php. You can't just copy the code in though - there's a bunch of boilerplate required in upgrade.php (see https://docs.moodle.org/dev/Upgrade_API), and it needs to correspond to your plugin version in version.php
Hope that helps!