Commit 370e7637 authored by Frederic Massart's avatar Frederic Massart Committed by Dan Poltawski
Browse files

MDL-55904 output: Deprecate action_menu::do_not_enhance()

Part of MDL-55071
parent 63e4df60
......@@ -278,8 +278,6 @@ preferences,moodle|/user/preferences.php|preferences',
$setting->set_updatedcallback('js_reset_all_caches');
$temp->add($setting);
$temp->add(new admin_setting_configcheckbox('modchooserdefault', new lang_string('modchooserdefault', 'admin'), new lang_string('configmodchooserdefault', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('modeditingmenu', new lang_string('modeditingmenu', 'admin'), new lang_string('modeditingmenu_desc', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('blockeditingmenu', new lang_string('blockeditingmenu', 'admin'), new lang_string('blockeditingmenu_desc', 'admin'), 1));
$ADMIN->add('appearance', $temp);
// link to tag management interface
......
......@@ -271,36 +271,7 @@ class core_course_renderer extends plugin_renderer_base {
$menu->set_constraint($constraint);
$menu->set_alignment(action_menu::TR, action_menu::BR);
$menu->set_menu_trigger(get_string('edit'));
if (isset($CFG->modeditingmenu) && !$CFG->modeditingmenu || !empty($displayoptions['donotenhance'])) {
$menu->do_not_enhance();
// Swap the left/right icons.
// Normally we have have right, then left but this does not
// make sense when modactionmenu is disabled.
$moveright = null;
$_actions = array();
foreach ($actions as $key => $value) {
if ($key === 'moveright') {
// Save moveright for later.
$moveright = $value;
} else if ($moveright) {
// This assumes that the order was moveright, moveleft.
// If we have a moveright, then we should place it immediately after the current value.
$_actions[$key] = $value;
$_actions['moveright'] = $moveright;
// Clear the value to prevent it being used multiple times.
$moveright = null;
} else {
$_actions[$key] = $value;
}
}
$actions = $_actions;
unset($_actions);
}
foreach ($actions as $action) {
if ($action instanceof action_menu_link) {
$action->add_class('cm-edit-action');
......
......@@ -76,8 +76,6 @@ $string['badwordsconfig'] = 'Enter your list of bad words separated by commas.';
$string['badwordsdefault'] = 'If the custom list is empty, a default list from the language pack will be used.';
$string['badwordslist'] = 'Custom bad words list';
$string['blockediplist'] = 'Blocked IP List';
$string['blockeditingmenu'] = 'Block editing menus';
$string['blockeditingmenu_desc'] = 'If enabled many of the block editing icons shown when editing is on will be displayed within a drop-down menu. This reduces the content on screen by hiding the icons until they are needed.';
$string['blockinstances'] = 'Instances';
$string['blockmultiple'] = 'Multiple';
$string['blockprotect'] = 'Protect instances';
......@@ -726,8 +724,6 @@ $string['mobile'] = 'Mobile';
$string['mobilecssurl'] = 'CSS';
$string['modchooserdefault'] = 'Activity chooser default';
$string['modeditdefaults'] = 'Default values for activity settings';
$string['modeditingmenu'] = 'Activity editing menus';
$string['modeditingmenu_desc'] = 'If enabled many of the activity editing icons shown when viewing a course with editing on will be displayed within a drop-down menu. This reduces the content on screen when editing a course by hiding the icons until they are needed.';
$string['modsettings'] = 'Manage activities';
$string['modulesecurity'] = 'Module security';
$string['multilangforceold'] = 'Force old multilang syntax: <span> without the class="multilang" and <lang>';
......
......@@ -4087,9 +4087,11 @@ class action_menu implements renderable, templatable {
* If you call this method the action menu will be displayed but will not be enhanced.
*
* By not displaying the menu enhanced all items will be displayed in a single row.
*
* @deprecated since Moodle 3.2
*/
public function do_not_enhance() {
unset($this->attributes['data-enhance']);
debugging('The method action_menu::do_not_enhance() is deprecated, use a list of action_icon instead.', DEBUG_DEVELOPER);
}
/**
......
......@@ -1293,9 +1293,6 @@ class core_renderer extends renderer_base {
}
$menu->set_constraint('.block-region');
$menu->attributes['class'] .= ' block-control-actions commands';
if (isset($CFG->blockeditingmenu) && !$CFG->blockeditingmenu) {
$menu->do_not_enhance();
}
return $this->render($menu);
}
......
......@@ -93,6 +93,7 @@ information provided here is intended especially for developers.
should be forced to be displayed in LTR based on the PARAM type associated with it. You
can call $mform->setForceLtr($elementName, true/false) on some form fields to manually
set the value.
* Action menus do_not_enhance() is deprecated, use a list of action_icon instead.
=== 3.1 ===
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment