MDL-86744 customfield: Pass toggle data only when necessary

This commit is contained in:
Jun Pataleta
2025-09-25 07:19:01 +08:00
parent ffe71d0f0f
commit 33275d6ec4
4 changed files with 8 additions and 6 deletions
@@ -110,13 +110,15 @@ class management implements renderable, templatable {
['name' => 'data-area', 'value' => $data->area],
['name' => 'data-itemid', 'value' => $data->itemid],
];
$categoryarray['toggle'] = $output->render_from_template('core/toggle', [
if (!$canedit) {
$categoryarray['toggle'] = $output->render_from_template('core/toggle', [
'id' => 'shared-toggle-' . $category->get('id'),
'checked' => $toggleenabled,
'extraattributes' => $attributes,
'label' => get_string('enableplugin', 'core_admin', $category->get_formatted_name()),
'labelclasses' => 'visually-hidden',
]);
}
$categoryarray['fields'] = array();
+1 -1
View File
@@ -131,7 +131,7 @@ class core_customfield_external extends external_api {
)
)
, '', VALUE_OPTIONAL),
'toggle' => new external_value(PARAM_RAW, 'toggle'),
'toggle' => new external_value(PARAM_RAW, 'toggle', VALUE_OPTIONAL),
)
)
),
+3 -3
View File
@@ -88,11 +88,11 @@
</a>
{{/canedit}}
</h3>
{{^canedit}}
{{#toggle}}
<div data-bs-toggle="tooltip" data-bs-placement="top" title="{{#str}} sharedcategoryhelptext, customfield {{/str}}">
{{{toggle}}}
{{{.}}}
</div>
{{/canedit}}
{{/toggle}}
{{/usescategories}}
</div>
<div class="col-auto text-end">
+1 -1
View File
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2025092300.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2025092500.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '5.1beta (Build: 20250923)'; // Human-friendly version name