Skip to content

Commit

Permalink
Fix setting dependencies for Moodle 4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
justusdieckmann committed May 14, 2024
1 parent d638207 commit d72f7fb
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions backup/moodle2/backup_opencast_block_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ protected function define_my_settings() {
true
);
$setting->get_ui()->set_label(get_string('backupopencastvideos', 'block_opencast', $ocinstance->name));
$setting->set_value(boolval($defaultimportvalue));

foreach ($seriestobackup as $series) {
$seriesobj = $apibridge->get_series_by_identifier($series->series, false);
Expand Down Expand Up @@ -113,6 +114,7 @@ protected function define_my_settings() {
true,
backup_block_opencast_setting::SECTION_LEVEL
);
$seriessetting->set_value(boolval($defaultimportvalue));
$stringobj = new \stdClass();
$stringobj->title = $seriesobj->title;
// To avoid cluttered ui and ugly display, we present only the last 6 digit of the id.
Expand All @@ -128,7 +130,7 @@ protected function define_my_settings() {
);
}
$this->add_setting($seriessetting);
$this->get_setting($includesettingname)->add_dependency($seriessetting);
$this->get_setting($includesettingname)->add_dependency($seriessetting, setting_dependency::DISABLED_NOT_CHECKED);

foreach ($videostobackup as $bkvideo) {
// Activity level settings for episodes.
Expand All @@ -146,6 +148,7 @@ protected function define_my_settings() {
backup_block_opencast_setting::VISIBLE,
$status
);
$episodesetting->set_value(boolval($defaultimportvalue));
$stringobj = new \stdClass();
$stringobj->title = $bkvideo->title;
// To avoid cluttered ui and ugly display, we present only the last 6 digit of the id.
Expand All @@ -154,16 +157,10 @@ protected function define_my_settings() {
get_string('importvideos_wizard_event_cb_title', 'block_opencast', $stringobj)
);
$this->add_setting($episodesetting);
$this->get_setting($seriessettingname)->add_dependency($episodesetting);
$this->get_setting($seriessettingname)->add_dependency($episodesetting, setting_dependency::DISABLED_NOT_CHECKED);
}
// We only set value after the child setting are added, this is important because the value change affects
// the dependencies in moodle core.
$seriessetting->set_value(true);
}
}
// We only set value after the child setting are added, this is important because the value change affects
// the dependencies in moodle core.
$setting->set_value(boolval($defaultimportvalue));
}
}
}
Expand Down

0 comments on commit d72f7fb

Please sign in to comment.