MDL-76975 admin: Move AMD dependencies to data attribute to fix overflow

Since there is a 1024 length limit on arguments passed through
js_call_amd(), we pass it through a HTML element dataset to avoid
this limit.
This commit is contained in:
Yerai Rodríguez
2026-01-14 08:34:06 +01:00
parent 9699514341
commit 5f075b79be
7 changed files with 64 additions and 14 deletions
+2 -4
View File
@@ -165,10 +165,8 @@ if (empty($SITE->fullname)) {
$PAGE->requires->js_call_amd('core_form/changechecker', 'watchFormById', ['adminsettings']);
if ($settingspage->has_dependencies()) {
$opts = [
'dependencies' => $settingspage->get_dependencies_for_javascript()
];
$PAGE->requires->js_call_amd('core/showhidesettings', 'init', [$opts]);
$context = ['dependencies' => json_encode($settingspage->get_dependencies_for_javascript())];
echo $OUTPUT->render_from_template('core_admin/settings_showhide', $context);
}
echo $OUTPUT->footer();