Skip to content

Commit d790692

Browse files
committed
Issue #137: Cleanup debugging noise
Generates a localid for records that are forced via config.php
1 parent 85b22eb commit d790692

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

classes/form/config.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,24 +177,20 @@ public function definition() {
177177
$mform->setDefault('secretkey', envbarlib::get_secret_key());
178178
$mform->addHelpButton('secretkeyg', 'secretkey', 'local_envbar');
179179

180-
$localid = -1;
181-
182180
foreach ($records as $record) {
183181

184182
$locked = false;
185183

186184
// Local records set in config.php will be locked for editing.
187185
if (isset($record->local)) {
188-
$record->id = $localid;
189186
$locked = true;
190187

191188
$mform->addElement(
192189
"hidden",
193-
"locked[{$localid}]",
190+
"locked[{$record->id}]",
194191
$locked
195192
);
196-
$mform->setType("locked[{$localid}]", PARAM_INT);
197-
$localid--;
193+
$mform->setType("locked[{$record->id}]", PARAM_INT);
198194
}
199195

200196
$id = $record->id;

classes/local/envbarlib.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,10 @@ public static function get_records() {
230230

231231
// Converting them to stdClass and adding a local flag.
232232
foreach ($items as $key => $value) {
233-
$value['local'] = true;
234-
$items[$key] = (object) $value;
233+
$record = (object) $value;
234+
$record->id = $key . 'LOCAL';
235+
$record->local = true;
236+
$items[$key] = $record;
235237
}
236238

237239
$result = array_merge($items, $result);

0 commit comments

Comments
 (0)