mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 08:55:15 +02:00
MDL-63219 Output: Enable filters in custom menus.
This commit is contained in:
parent
30692df849
commit
b2d59a0372
@ -330,6 +330,10 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
|
||||
$temp->add(new admin_setting_configcheckbox('logininfoinsecurelayout',
|
||||
new lang_string('logininfoinsecurelayout', 'admin'),
|
||||
new lang_string('logininfoinsecurelayout_desc', 'admin'), 0));
|
||||
// Process primary navigation (custom menu) through Moodle filters.
|
||||
$temp->add(new admin_setting_configcheckbox('navfilter',
|
||||
new lang_string('navfilter', 'admin'),
|
||||
new lang_string('navfilter_desc', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtextarea('custommenuitems', new lang_string('custommenuitems', 'admin'),
|
||||
new lang_string('configcustommenuitems', 'admin'), '', PARAM_RAW, '50', '10'));
|
||||
$defaultsettingcustomusermenuitems = [
|
||||
|
@ -320,7 +320,14 @@ class api {
|
||||
$settings->tool_mobile_customlangstrings = get_config('tool_mobile', 'customlangstrings');
|
||||
$settings->tool_mobile_disabledfeatures = get_config('tool_mobile', 'disabledfeatures');
|
||||
$settings->tool_mobile_filetypeexclusionlist = get_config('tool_mobile', 'filetypeexclusionlist');
|
||||
$settings->tool_mobile_custommenuitems = get_config('tool_mobile', 'custommenuitems');
|
||||
$custommenuitems = get_config('tool_mobile', 'custommenuitems');
|
||||
// If filtering of the primary custom menu is enabled, apply only the string filters.
|
||||
if (!empty($CFG->navfilter && !empty($CFG->stringfilters))) {
|
||||
// Apply filters that are enabled for Content and Headings.
|
||||
$filtermanager = \filter_manager::instance();
|
||||
$custommenuitems = $filtermanager->filter_string($custommenuitems, \context_system::instance());
|
||||
}
|
||||
$settings->tool_mobile_custommenuitems = $custommenuitems;
|
||||
$settings->tool_mobile_apppolicy = get_config('tool_mobile', 'apppolicy');
|
||||
// This setting could be not set in some edge cases such as bad upgrade.
|
||||
$mintimereq = get_config('tool_mobile', 'autologinmintimebetweenreq');
|
||||
|
@ -920,6 +920,8 @@ $string['minpasswordnonalphanum'] = 'Non-alphanumeric characters';
|
||||
$string['minpasswordupper'] = 'Uppercase letters';
|
||||
$string['misc'] = 'Miscellaneous';
|
||||
$string['mlbackendsettings'] = 'Machine learning backend settings';
|
||||
$string['navfilter'] = 'Filter custom menu';
|
||||
$string['navfilter_desc'] = 'Process the custom menu through Moodle filters that are set to apply to <strong>Content and Headings</strong>. Useful for enabling dynamic custom menu items.';
|
||||
$string['mnetrestore_extusers'] = '<strong>Note:</strong> This backup file contains remote Moodle Network user accounts which will be restored as part of the process.';
|
||||
$string['mnetrestore_extusers_admin'] = '<strong>Note:</strong> This backup file seems to come from a different Moodle installation and contains remote Moodle Network user accounts. The restore process will try to match the Moodle Network hosts for all created users. Those not matching will be automatically switched to internal authentication (instead of mnet one). The restore log will inform you about that.';
|
||||
$string['mnetrestore_extusers_mismatch'] = '<strong>Note:</strong> This backup file apparently originates from a different Moodle installation and contains remote Moodle Network user accounts that may fail to restore. This operation is unsupported. If you are certain that it was created on this Moodle installation, or you can ensure that all the needed Moodle Network Hosts are configured, you may want to still try the restore.';
|
||||
|
@ -20,6 +20,7 @@ use renderable;
|
||||
use renderer_base;
|
||||
use templatable;
|
||||
use custom_menu;
|
||||
use filter_manager;
|
||||
|
||||
/**
|
||||
* Primary navigation renderable
|
||||
@ -119,6 +120,14 @@ class primary implements renderable, templatable {
|
||||
}
|
||||
|
||||
$custommenuitems = $CFG->custommenuitems;
|
||||
|
||||
// If filtering of the primary custom menu is enabled, apply only the string filters.
|
||||
if (!empty($CFG->navfilter && !empty($CFG->stringfilters))) {
|
||||
// Apply filters that are enabled for Content and Headings.
|
||||
$filtermanager = \filter_manager::instance();
|
||||
$custommenuitems = $filtermanager->filter_string($custommenuitems, \context_system::instance());
|
||||
}
|
||||
|
||||
$currentlang = current_language();
|
||||
$custommenunodes = custom_menu::convert_text_to_menu_nodes($custommenuitems, $currentlang);
|
||||
$nodes = [];
|
||||
|
@ -3486,6 +3486,14 @@ EOD;
|
||||
if (empty($custommenuitems) && !empty($CFG->custommenuitems)) {
|
||||
$custommenuitems = $CFG->custommenuitems;
|
||||
}
|
||||
|
||||
// If filtering of the primary custom menu is enabled, apply only the string filters.
|
||||
if (!empty($CFG->navfilter && !empty($CFG->stringfilters))) {
|
||||
// Apply filters that are enabled for Content and Headings.
|
||||
$filtermanager = \filter_manager::instance();
|
||||
$custommenuitems = $filtermanager->filter_string($custommenuitems, \context_system::instance());
|
||||
}
|
||||
|
||||
$custommenu = new custom_menu($custommenuitems, current_language());
|
||||
return $this->render_custom_menu($custommenu);
|
||||
}
|
||||
@ -3501,6 +3509,14 @@ EOD;
|
||||
if (empty($custommenuitems) && !empty($CFG->custommenuitems)) {
|
||||
$custommenuitems = $CFG->custommenuitems;
|
||||
}
|
||||
|
||||
// If filtering of the primary custom menu is enabled, apply only the string filters.
|
||||
if (!empty($CFG->navfilter && !empty($CFG->stringfilters))) {
|
||||
// Apply filters that are enabled for Content and Headings.
|
||||
$filtermanager = \filter_manager::instance();
|
||||
$custommenuitems = $filtermanager->filter_string($custommenuitems, \context_system::instance());
|
||||
}
|
||||
|
||||
$custommenu = new custom_menu($custommenuitems, current_language());
|
||||
$langs = get_string_manager()->get_list_of_translations();
|
||||
$haslangmenu = $this->lang_menu() != '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user