MDL-83081 mod_label: remove dndmedia setting

This commit is contained in:
ferran
2025-05-13 16:29:29 +02:00
parent 9242f9619a
commit ecadc40c0d
7 changed files with 39 additions and 21 deletions
@@ -0,0 +1,7 @@
issueNumber: MDL-83081
notes:
mod_label:
- message: >-
The dndmedia setting has been removed. From now on dropping a media file
into a course will always ask the user if they want to create a label.
type: removed
+7
View File
@@ -59,5 +59,12 @@ function xmldb_label_upgrade($oldversion) {
// Automatically generated Moodle v5.0.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2025051300) {
// The dndmedia setting is not used anymore, so we remove it.
unset_config('dndmedia', 'label');
upgrade_mod_savepoint(true, 2025051300, 'label');
}
return true;
}
+2
View File
@@ -0,0 +1,2 @@
configdndmedia,mod_label
dndmedia,mod_label
+4 -2
View File
@@ -23,10 +23,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['configdndmedia'] = 'Offer to create a Text and media area when media files are dragged and dropped onto a course.';
$string['configdndresizeheight'] = 'When a Text and media area is created from a dragged and dropped media file, resize it if it is higher than this many pixels. If set to zero, the media file will not be resized.';
$string['configdndresizewidth'] = 'When a Text and media area is created from a dragged and dropped media file, resize it if it is wider than this many pixels. If set to zero, the media file will not be resized.';
$string['dndmedia'] = 'Media drag and drop';
$string['dndresizeheight'] = 'Resize drag and drop height';
$string['dndresizewidth'] = 'Resize drag and drop width';
$string['dnduploadlabel'] = 'Add media to course page';
@@ -60,3 +58,7 @@ $string['privacy:metadata'] = 'The Text and media area plugin does not store any
$string['pluginadministration'] = 'Text and media area administration';
$string['pluginname'] = 'Text and media area';
$string['search:activity'] = 'Text and media area';
// Deprecated since Moodle 5.1.
$string['configdndmedia'] = 'Offer to create a Text and media area when media files are dragged and dropped onto a course.';
$string['dndmedia'] = 'Media drag and drop';
+18 -15
View File
@@ -213,28 +213,31 @@ function label_supports($feature) {
}
/**
* Register the ability to handle drag and drop file uploads
* Register the ability to handle drag and drop file uploads.
*
* @return array containing details of the files / types the mod can handle
*/
function label_dndupload_register() {
$strdnd = get_string('dnduploadlabel', 'mod_label');
if (get_config('label', 'dndmedia')) {
$mediaextensions = file_get_typegroup('extension', ['web_image', 'web_video', 'web_audio']);
$files = array();
foreach ($mediaextensions as $extn) {
$extn = trim($extn, '.');
$files[] = array('extension' => $extn, 'message' => $strdnd);
}
$ret = array('files' => $files);
} else {
$ret = array();
$mediaextensions = file_get_typegroup('extension', ['web_image', 'web_video', 'web_audio']);
$files = [];
foreach ($mediaextensions as $extn) {
$extn = trim($extn, '.');
$files[] = ['extension' => $extn, 'message' => $strdnd];
}
$ret = ['files' => $files];
$strdndtext = get_string('dnduploadlabeltext', 'mod_label');
return array_merge($ret, array('types' => array(
array('identifier' => 'text/html', 'message' => $strdndtext, 'noname' => true),
array('identifier' => 'text', 'message' => $strdndtext, 'noname' => true)
)));
return array_merge(
$ret,
[
'types' => [
['identifier' => 'text/html', 'message' => $strdndtext, 'noname' => true],
['identifier' => 'text', 'message' => $strdndtext, 'noname' => true],
],
],
);
}
/**
-3
View File
@@ -26,9 +26,6 @@
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configcheckbox('label/dndmedia',
get_string('dndmedia', 'mod_label'), get_string('configdndmedia', 'mod_label'), 1));
$settings->add(new admin_setting_configtext('label/dndresizewidth',
get_string('dndresizewidth', 'mod_label'), get_string('configdndresizewidth', 'mod_label'), 400, PARAM_INT, 6));
+1 -1
View File
@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2025041400; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2025051300; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2025040800; // Requires this Moodle version.
$plugin->component = 'mod_label'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 0;