diff --git a/public/customfield/classes/output/management.php b/public/customfield/classes/output/management.php index 1ff22a3b696..49be1e7b4a4 100644 --- a/public/customfield/classes/output/management.php +++ b/public/customfield/classes/output/management.php @@ -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(); diff --git a/public/customfield/externallib.php b/public/customfield/externallib.php index e18e2dcd7aa..4da6e08d6b5 100644 --- a/public/customfield/externallib.php +++ b/public/customfield/externallib.php @@ -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), ) ) ), diff --git a/public/customfield/templates/list.mustache b/public/customfield/templates/list.mustache index 5ca89ab2cc4..be601b2ddca 100644 --- a/public/customfield/templates/list.mustache +++ b/public/customfield/templates/list.mustache @@ -88,11 +88,11 @@ {{/canedit}} - {{^canedit}} + {{#toggle}}