/** * Update the settings for a single plugin. * * @param assign_plugin $plugin The plugin to update * @param stdClass $formdata The form data * @return bool false if an error occurs */ protected function update_plugin_instance(assign_plugin $plugin, stdClass $formdata) { if ($plugin->is_visible()) { $enabledname = $plugin->get_subtype() . '_' . $plugin->get_type() . '_enabled'; if (!empty($formdata->{$enabledname})) { $plugin->enable(); if (!$plugin->save_settings($formdata)) { print_error($plugin->get_error()); return false; } } else { $plugin->disable(); } } return true; }