From a09dc53828cdb224ef873d8874d49feab8ae4b56 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 8 Feb 2023 09:57:52 +0000 Subject: [PATCH] MDL-77177 mod_data: re-factor internal method argument order. We cannot have required method parameters after optional, it doesn't make sense. Also it causes deprecation notices in PHP8.1. --- mod/data/classes/template.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mod/data/classes/template.php b/mod/data/classes/template.php index da135f68b24..24f9fd898b7 100644 --- a/mod/data/classes/template.php +++ b/mod/data/classes/template.php @@ -923,7 +923,7 @@ class template { // Then we generate strings to replace. $otherfields = []; foreach ($possiblefields as $field) { - $fieldinput = $this->get_field_input($processeddata, $entryid, $entrydata, $field); + $fieldinput = $this->get_field_input($processeddata, $field, $entryid, $entrydata); if (strpos($templatecontent, "[[" . $field->field->name . "]]") !== false) { // Replace the field tag. $patterns[] = "[[" . $field->field->name . "]]"; @@ -968,16 +968,16 @@ class template { * Return the input form html from a specific field. * * @param stdClass $processeddata the previous process data information. + * @param data_field_base $field the field object * @param int|null $entryid the possible entry id * @param stdClass|null $entrydata the entry data from a previous form or from a real entry - * @param data_field_base $field the field object * @return string the add entry HTML content */ private function get_field_input( stdClass $processeddata, + data_field_base $field, ?int $entryid = null, - ?stdClass $entrydata = null, - data_field_base $field + ?stdClass $entrydata = null ): string { $renderer = $this->manager->get_renderer(); $errors = '';