MDL-75142 mod_data: Add description to presets
This commit adds support to description field for presets: - For plugin presets, description will be stored in the module_help string in lang files. - For saved presets, a new element, <description>, has been added to the preset.xml file, to include this information. A new field has been added to the "Save as preset" modal, to let users define description (which is empty by default, to support pre-existing presets that won't have it). Apart from that, the "Save as preset" workflow has been slightly improved, following the Product UX/UX suggestions to hide the checkbox to overwrite the preset by default and show it only if the user tries to save a preset with an existing name.
This commit is contained in:
@@ -341,14 +341,7 @@ class manager {
|
||||
continue;
|
||||
}
|
||||
|
||||
$preset = new stdClass();
|
||||
$preset->isplugin = false;
|
||||
$preset->path = $file->get_filepath();
|
||||
$preset->name = trim($preset->path, '/');
|
||||
$preset->shortname = $preset->name;
|
||||
$preset->userid = $userid;
|
||||
$preset->id = $file->get_id();
|
||||
$preset->storedfile = $file;
|
||||
$preset = preset::create_from_storedfile($this, $file);
|
||||
$presets[] = $preset;
|
||||
}
|
||||
|
||||
@@ -366,12 +359,7 @@ class manager {
|
||||
$dirs = core_component::get_plugin_list('datapreset');
|
||||
foreach ($dirs as $dir => $fulldir) {
|
||||
if (preset::is_directory_a_preset($fulldir)) {
|
||||
$preset = new stdClass();
|
||||
$preset->isplugin = true;
|
||||
$preset->path = $fulldir;
|
||||
$preset->userid = 0;
|
||||
$preset->shortname = $dir;
|
||||
$preset->name = preset::get_name_from_plugin($dir);
|
||||
$preset = preset::create_from_plugin(null, $dir);
|
||||
$presets[] = $preset;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user