Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Rename FormField Value to getFormattedValue #1363

Open
wants to merge 1 commit into
base: 7.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/FormField/UserFormsCheckboxSetField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 2 additions & 4 deletions code/Model/Submission/SubmittedFileField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member Author

@emteknetnz emteknetnz Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this method has the same name as FormField::getFormattedValue, it's a fundamentally different method

Putting strong typing on this is effectively unrelated refactoring

Note that the old docblock return type was wrong

{
$name = $this->getFileName();
$link = $this->getLink(false);
Expand Down Expand Up @@ -77,7 +75,7 @@ public function getFormattedValue()
));
}
}
return false;
return null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading