General developer forum

Add custom licenses to file picker

 
Picture of Chris Alfonso
Add custom licenses to file picker
 

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:

1. Reviewed https://moodle.org/mod/forum/discuss.php?d=355789 and  https://docs.moodle.org/dev/Tutorial

  • 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

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.


 
Average of ratings: -
Picture of Michael Aherne
Re: Add custom licenses to file picker
Core developersParticularly helpful MoodlersPlugin developers

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!

 
Average of ratings: -
Picture of Chris Alfonso
Re: Add custom licenses to file picker
 
Very helpful! Thank you Michael!
 
Average of ratings: -