Skip to content

Commit

Permalink
Issue #137: Cleanup debugging noise
Browse files Browse the repository at this point in the history
Generates a localid for records that are forced via config.php
  • Loading branch information
nhoobin committed Mar 22, 2021
1 parent 85b22eb commit d790692
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 2 additions & 6 deletions classes/form/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,24 +177,20 @@ public function definition() {
$mform->setDefault('secretkey', envbarlib::get_secret_key());
$mform->addHelpButton('secretkeyg', 'secretkey', 'local_envbar');

$localid = -1;

foreach ($records as $record) {

$locked = false;

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

$mform->addElement(
"hidden",
"locked[{$localid}]",
"locked[{$record->id}]",
$locked
);
$mform->setType("locked[{$localid}]", PARAM_INT);
$localid--;
$mform->setType("locked[{$record->id}]", PARAM_INT);
}

$id = $record->id;
Expand Down
6 changes: 4 additions & 2 deletions classes/local/envbarlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,10 @@ public static function get_records() {

// Converting them to stdClass and adding a local flag.
foreach ($items as $key => $value) {
$value['local'] = true;
$items[$key] = (object) $value;
$record = (object) $value;
$record->id = $key . 'LOCAL';
$record->local = true;
$items[$key] = $record;
}

$result = array_merge($items, $result);
Expand Down

0 comments on commit d790692

Please sign in to comment.