mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-73833 adminpresets: Use displayname from pluginmanager
In order to guarantee all the plugin type names are displayed properly, the 'pluginname' string call has been replaced to the proper $plugininfo->displayname setting. That way, the plugin names will be always displayed using the proper string translation.
This commit is contained in:
parent
e94167174a
commit
00699beeed
@ -926,13 +926,17 @@ class manager {
|
||||
// Plugins.
|
||||
$plugins = $DB->get_records('adminpresets_app_plug', ['adminpresetapplyid' => $presetappid]);
|
||||
if ($plugins) {
|
||||
$pluginmanager = \core_plugin_manager::instance();
|
||||
foreach ($plugins as $plugin) {
|
||||
$pluginclass = \core_plugin_manager::resolve_plugininfo_class($plugin->plugin);
|
||||
$pluginclass::enable_plugin($plugin->name, (int) $plugin->oldvalue);
|
||||
|
||||
$visiblename = $plugin->plugin . '_' . $plugin->name;
|
||||
if (get_string_manager()->string_exists('pluginname', $plugin->plugin . '_' . $plugin->name)) {
|
||||
$visiblename = get_string('pluginname', $plugin->plugin . '_' . $plugin->name);
|
||||
// Get the plugininfo object for this plugin, to get its proper visible name.
|
||||
$plugininfo = $pluginmanager->get_plugin_info($plugin->plugin . '_' . $plugin->name);
|
||||
if ($plugininfo != null) {
|
||||
$visiblename = $plugininfo->displayname;
|
||||
} else {
|
||||
$visiblename = $plugin->plugin . '_' . $plugin->name;
|
||||
}
|
||||
|
||||
// Output table.
|
||||
@ -1087,14 +1091,19 @@ class manager {
|
||||
$strdisabled = get_string('disabled', 'core_adminpresets');
|
||||
|
||||
$plugins = $DB->get_records('adminpresets_plug', ['adminpresetid' => $presetid]);
|
||||
$pluginmanager = \core_plugin_manager::instance();
|
||||
foreach ($plugins as $plugin) {
|
||||
$pluginclass = \core_plugin_manager::resolve_plugininfo_class($plugin->plugin);
|
||||
$oldvalue = $pluginclass::get_enabled_plugin($plugin->name);
|
||||
|
||||
$visiblename = $plugin->plugin . '_' . $plugin->name;
|
||||
if (get_string_manager()->string_exists('pluginname', $plugin->plugin . '_' . $plugin->name)) {
|
||||
$visiblename = get_string('pluginname', $plugin->plugin . '_' . $plugin->name);
|
||||
// Get the plugininfo object for this plugin, to get its proper visible name.
|
||||
$plugininfo = $pluginmanager->get_plugin_info($plugin->plugin . '_' . $plugin->name);
|
||||
if ($plugininfo != null) {
|
||||
$visiblename = $plugininfo->displayname;
|
||||
} else {
|
||||
$visiblename = $plugin->plugin . '_' . $plugin->name;
|
||||
}
|
||||
|
||||
if ($plugin->enabled > 0) {
|
||||
$visiblevalue = $strenabled;
|
||||
} else if ($plugin->enabled == 0) {
|
||||
|
@ -86,7 +86,7 @@ Feature: I can apply presets
|
||||
And I should see "Server files" in the "Setting changes" "table"
|
||||
And I should see "Show data retention summary" in the "Setting changes" "table"
|
||||
And I should see "Social activities" in the "Setting changes" "table"
|
||||
And I should see "Social format" in the "format" "table_row"
|
||||
And I should see "Social format" in the "Setting changes" "table"
|
||||
And I should see "Starred courses" in the "Setting changes" "table"
|
||||
And I should see "Survey" in the "Setting changes" "table"
|
||||
And I should see "Tags" in the "Setting changes" "table"
|
||||
@ -95,6 +95,9 @@ Feature: I can apply presets
|
||||
And I should see "Wiki" in the "Setting changes" "table"
|
||||
And I should see "Wikimedia" in the "Setting changes" "table"
|
||||
And I should see "Workshop" in the "Setting changes" "table"
|
||||
# Check filters and data formats strings are displayed properly.
|
||||
And I should see "Activity names auto-linking" in the "Setting changes" "table"
|
||||
And I should see "Javascript Object Notation (.json)" in the "Setting changes" "table"
|
||||
# Apply the Starter preset.
|
||||
And I click on "Apply" "button"
|
||||
And I navigate to "Advanced features" in site administration
|
||||
|
Loading…
x
Reference in New Issue
Block a user