Skip to content

Commit e21962a

Browse files
committed
MDL-85359 core_ltix: make placement configuration form to be dynamic
1 parent 2cf0464 commit e21962a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ltix/classes/form/edit_types.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ public function definition() {
257257
// The visibility of these sections should depend on the selection of the "toolplacements" element.
258258
foreach ($registeredplacementtypes as $key => $value) {
259259
$this->add_placement_config_elements($mform, $key, $value);
260+
261+
// Dynamically hide it depending on the toolplacements[] field
262+
$unrelatedplacementtypeids = array_values(array_diff(array_keys($registeredplacementtypes), [$key]));
263+
$unrelatedplacementtypeids = array_merge($unrelatedplacementtypeids, ['']); // Include blank entry to represent no selection
264+
$mform->hideIf("toolplacement_placement_{$key}", 'toolplacements[]', 'in', $unrelatedplacementtypeids);
260265
}
261266

262267
// Restrict to course categories.

0 commit comments

Comments
 (0)