Skip to content

Commit 6adc789

Browse files
committed
MDL-85359 core_ltix: make placement configuration form to be dynamic
1 parent a337b5b commit 6adc789

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ltix/classes/form/edit_types.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ public function definition() {
256256
// This ideally should depend on the selection of the "toolplacements" element.
257257
foreach ($registeredplacementtypes as $key => $value) {
258258
$this->add_placement_config_elements($mform, $key, explode(':', $value)[1]);
259+
260+
// Dynamically hide it depending on the toolplacements[] field
261+
$unrelatedplacementtypeids = array_diff(array_keys($registeredplacementtypes), [$key]);
262+
$mform->hideIf("toolplacement_placement_{$key}", 'toolplacements[]', 'in', $unrelatedplacementtypeids);
259263
}
260264

261265
// Restrict to course categories.

0 commit comments

Comments
 (0)