From 6a92ecedcdaa644ab8b47ec617c37f18186b41a5 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 23 Jan 2025 16:52:34 +1300 Subject: [PATCH] API Rename FormField Value to getFormattedValue --- code/FormField/UserFormsCheckboxSetField.php | 2 +- code/Model/Submission/SubmittedFileField.php | 6 ++---- .../EditableFormField/EditableCountryDropdownFieldTest.php | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/code/FormField/UserFormsCheckboxSetField.php b/code/FormField/UserFormsCheckboxSetField.php index 43fb595d0..6338ff831 100644 --- a/code/FormField/UserFormsCheckboxSetField.php +++ b/code/FormField/UserFormsCheckboxSetField.php @@ -47,7 +47,7 @@ public function getOptions() public function getValueForValidation(): mixed { - $value = $this->Value(); + $value = $this->getValue(); if (is_iterable($value) || is_null($value)) { return $value; } diff --git a/code/Model/Submission/SubmittedFileField.php b/code/Model/Submission/SubmittedFileField.php index 8b3c73f4f..49a969ed4 100755 --- a/code/Model/Submission/SubmittedFileField.php +++ b/code/Model/Submission/SubmittedFileField.php @@ -36,10 +36,8 @@ class SubmittedFileField extends SubmittedFormField /** * Return the value of this field for inclusion into things such as * reports. - * - * @return string */ - public function getFormattedValue() + public function getFormattedValue(): ?DBField { $name = $this->getFileName(); $link = $this->getLink(false); @@ -77,7 +75,7 @@ public function getFormattedValue() )); } } - return false; + return null; } /** diff --git a/tests/php/Model/EditableFormField/EditableCountryDropdownFieldTest.php b/tests/php/Model/EditableFormField/EditableCountryDropdownFieldTest.php index 4426ead80..cfbb85d41 100644 --- a/tests/php/Model/EditableFormField/EditableCountryDropdownFieldTest.php +++ b/tests/php/Model/EditableFormField/EditableCountryDropdownFieldTest.php @@ -38,7 +38,7 @@ public function testDefaultValue() /** @var EditableCountryDropdownField $field */ $field = EditableCountryDropdownField::create(); $field->Default = 'nz'; - $this->assertEquals($field->getFormField()->Value(), 'nz'); + $this->assertEquals($field->getFormField()->getValue(), 'nz'); } public function testEmptyDefaultValue()