Closed abias closed 1 year ago
Hi @abias,
I like this feature a lot. And can think of multiple ways to implement this.
Have you any ideas what would be the 'best' way?
My first thought would be to set files in an filearea and copy them over to dataroot by a scheduled task?
Off the top of my head, I really don't know how to tie 'post-processing' to admin_settings : /
On a side note, I worked on the filetypes icons for the URL and the File resource which IMHO wouldn't been tackeled by this proposal here, and they have to be fixed in core: https://tracker.moodle.org/browse/MDL-75611
My first thought would be to set files in an filearea and copy them over to dataroot by a scheduled task? Off the top of my head, I really don't know how to tie 'post-processing' to admin_settings : /
There is the $setting->set_updatedcallback()
function within the admin settings framework (see https://github.com/moodle-an-hochschulen/moodle-theme_boost_union/blob/master/settings.php#L203) for an example. This callback function is called as soon as the setting is stored and its value has changed. You would just have to write a custom callback function which takes the icons from the filearea and puts them into the Moodledata directory.
And, in this particular case, you would have to use the https://github.com/moodle-an-hochschulen/moodle-theme_boost_union/blob/master/classes/admin_setting_configstoredfilealwayscallback.php setting class due to a Moodle core bug with the set_updatedcallback feature.
Note:
This was solved now in #209. The aspect of uploading zip files was postponed into #295
Moodle core supports the replacement of activity icons by placing new icons within the theme directory, but also within Moodledata (see https://github.com/moodle/moodle/blob/15d4ea81e003439c528004a8d555a07cad0f02d3/lib/outputlib.php#L2151-L2169). The second approach is the update-safe approach and should be preferred over placing icons into the theme directory. However, this approach is only usable for admins who have file system access to Moodledata.
It would be worthwhile to add an upload possibility to Boost Union which would take custom activity icons and which will place them in Moodledata.