Skip to content

Commit

Permalink
CONTRIB-9449: Fix parameter options (#13)
Browse files Browse the repository at this point in the history
* Predefined value e.g. activity.info.iconurl removed as placeholder value
* After form submission parameter deleted in form is deleted in DB
  • Loading branch information
ssj365 authored Sep 30, 2024
1 parent 6e83b34 commit d697245
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions classes/bigbluebuttonbn/mod_form_addons.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public function add_fields(): void {
'tags' => true,
]
);
$paramvalue->setValue('');
$paramtype = $this->mform->createElement(
'select',
"flexurl_eventtype[$index]",
Expand Down
6 changes: 6 additions & 0 deletions classes/bigbluebuttonbn/mod_instance_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ public function add_instance(stdClass $bigbluebuttonbn) {
*/
private function sync_additional_params(stdClass $bigbluebuttonbn): void {
global $DB;
// Retrieve existing parameters from the database.
$existingparams = $DB->get_records(self::SUBPLUGIN_TABLE, ['bigbluebuttonbnid' => $bigbluebuttonbn->id]);
// Checks first.
$count = $bigbluebuttonbn->flexurl_paramcount ?? 0;
foreach (utils::PARAM_TYPES as $type => $paramtype) {
if (!isset($bigbluebuttonbn->{'flexurl_' . $type})) {
// If the parameters were deleted, the deletion must be synced in the DB.
if (!empty($existingparams)) {
continue;
}
return;
}
if ($count != count($bigbluebuttonbn->{'flexurl_' . $type})) {
Expand Down

0 comments on commit d697245

Please sign in to comment.