Skip to content

Commit

Permalink
move deprecated external methods as internal methods (#689)
Browse files Browse the repository at this point in the history
  • Loading branch information
ixiongtii authored Dec 19, 2023
1 parent c81215b commit 6b93bb9
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,10 @@ public function is_plugin_configured() {
/**
* Save the form data associated with the plugin
*
* TODO: This code needs to be moved for 4.3 as the method will be completely removed from core.
* See https://tracker.moodle.org/browse/MDL-67526
*
* @global type $DB
* @param object $data the form data to save
*/
public function save_form_elements($data) {
public function save_form_data($data) {
global $DB;

$moduletiienabled = $this->get_config_settings('mod_'.$data->modulename);
Expand Down Expand Up @@ -264,24 +261,13 @@ public function save_form_elements($data) {
/**
* Add the Turnitin settings form to an add/edit activity page
*
* TODO: This code needs to be moved for 4.3 as the method will be completely removed from core.
* See https://tracker.moodle.org/browse/MDL-67526
*
* @param object $mform
* @param object $context
* @return type
*/
public function get_form_elements_module($mform, $context, $modulename = "") {
public function add_settings_form_to_activity_page($mform, $context, $modulename = "") {
global $DB, $PAGE, $COURSE;

// This is a bit of a hack and untidy way to ensure the form elements aren't displayed
// twice. This won't be needed once this method goes away.
// TODO: Remove once this method goes away.
static $settingsdisplayed;
if ($settingsdisplayed) {
return;
}

if (has_capability('plagiarism/turnitin:enable', $context)) {
// Get Course module id and values.
$cmid = optional_param('update', null, PARAM_INT);
Expand Down Expand Up @@ -2914,7 +2900,7 @@ function plagiarism_turnitin_coursemodule_standard_elements($formwrapper, $mform

$context = context_course::instance($formwrapper->get_course()->id);

$pluginturnitin->get_form_elements_module(
$pluginturnitin->add_settings_form_to_activity_page(
$mform,
$context,
isset($formwrapper->get_current()->modulename) ? 'mod_'.$formwrapper->get_current()->modulename : '');
Expand All @@ -2929,7 +2915,7 @@ function plagiarism_turnitin_coursemodule_standard_elements($formwrapper, $mform
function plagiarism_turnitin_coursemodule_edit_post_actions($data, $course) {
$pluginturnitin = new plagiarism_plugin_turnitin();

$pluginturnitin->save_form_elements($data);
$pluginturnitin->save_form_data($data);

return $data;
}
Expand Down

0 comments on commit 6b93bb9

Please sign in to comment.