MDL-59980 core_admin: Fix bug preventing block modification in settings
authorKristian Ringer <kristian.ringer@catalyst-au.net>
Fri, 25 May 2018 05:48:04 +0000 (15:48 +1000)
committerKristian Ringer <kristian.ringer@catalyst-au.net>
Tue, 12 Jun 2018 23:36:27 +0000 (09:36 +1000)
admin/settings.php
admin/templates/settings.mustache
theme/boost/templates/core_admin/settings.mustache

index 6292240..ecd2455 100644 (file)
@@ -38,7 +38,8 @@ if (!($settingspage->check_access())) {
 $statusmsg = '';
 $errormsg  = '';
 
-if ($data = data_submitted() and confirm_sesskey()) {
+// Form is submitted with changed settings. Do not want to execute when modifying a block.
+if ($data = data_submitted() and confirm_sesskey() and isset($data->action) and $data->action == 'save-settings') {
 
     $count = admin_write_settings($data);
     // Regardless of whether any setting change was written (a positive count), check validation errors for those that didn't.
index 4f351b8..0097305 100644 (file)
@@ -40,6 +40,7 @@
     <div class="settingsform clearfix">
         {{#params}}
             <input type="hidden" name="{{name}}" value="{{value}}">
+            <input type="hidden" name="action" value="save-settings">
         {{/params}}
         <input type="hidden" name="sesskey" value="{{sesskey}}">
         <input type="hidden" name="return" value="{{return}}">
index 1de9250..c75925a 100644 (file)
@@ -21,6 +21,7 @@
     <div class="settingsform">
         {{#params}}
             <input type="hidden" name="{{name}}" value="{{value}}">
+            <input type="hidden" name="action" value="save-settings">
         {{/params}}
         <input type="hidden" name="sesskey" value="{{sesskey}}">
         <input type="hidden" name="return" value="{{return}}">