-
Bug
-
Resolution: Fixed
-
Minor
-
3.9.2
-
MOODLE_39_STABLE
-
MOODLE_310_STABLE, MOODLE_39_STABLE
-
MDL-69748-master -
-
4
-
International 4.0 - Sprint 7, Internationals - 3.11 Sprint 2, Internationals - 3.11 Sprint 3, Internationals - 3.11 Sprint 4, Internationals - 3.11 Sprint 5
The hide_if function of adminlib appears to have no effect on filesize inputs, so those settings cannot be hidden based on the value of other settings.
Steps to reproduce:
- Open the /admin/settings/courses.php file in your IDE.
- Paste the following inside the first IF statement (it can be the first thing inside the IF), then save the file:
$temp = new admin_settingpage('testinghideif', 'Testing hide_if');
$testvals = [0 => 'Hide children', 1 => 'Show children'];
$temp->add(new admin_setting_configselect('parentsetting', 'Parent setting', 'Selecting "Hide children" should hide both.', 1, $testvals));
$temp->add(new filesize('childsetting1', 'Child setting 1', 'Bug - This will not hide when "Hide children" has been selected above.', 1024));
$temp->add(new admin_setting_configcheckbox('childsetting2', 'Child setting 2', 'This will correctly be hidden.', 0));
$temp->hide_if('childsetting1', 'parentsetting', 'eq', 0);
$temp->hide_if('childsetting2', 'parentsetting', 'eq', 0);
$ADMIN->add('courses', $temp);
- Log in as admin, then navigate to <wwwroot>/admin/settings.php?section=testinghideif
- Set the "Parent setting" to "Show children".
- You should see two other settings, "Child setting 1" (a filesize input), and "Child setting 2" (a checkbox).
- Change the "Parent setting" to "Hide children".
- Expected: Both child settings are hidden (the code to hide both used in step 2 is identical).
- Actual: Child setting 2 will be hidden, while Child setting 1 will remain visible.
- Discovered while testing
-
MDL-69559 Course content download - add site admin and course level settings, implement in course user interface
- Closed