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..391577d92 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(): string { $name = $this->getFileName(); $link = $this->getLink(false); @@ -51,33 +49,33 @@ public function getFormattedValue() // Logged in CMS user without permissions to view file in the CMS $default = 'You don\'t have the right permissions to download this file'; $message = _t(__CLASS__ . '.INSUFFICIENTRIGHTS', $default); - return DBField::create_field('HTMLText', sprintf( + return sprintf( ' %s - %s', htmlspecialchars($name, ENT_QUOTES), htmlspecialchars($message, ENT_QUOTES) - )); + ); } else { // Userforms submission filled in by non-logged in user being emailed to recipient $message = _t(__CLASS__ . '.YOUMUSTBELOGGEDIN', 'You must be logged in to view this file'); - return DBField::create_field('HTMLText', sprintf( + return sprintf( '%s - %s - %s', htmlspecialchars($name, ENT_QUOTES), htmlspecialchars($link, ENT_QUOTES), htmlspecialchars($title, ENT_QUOTES), htmlspecialchars($message, ENT_QUOTES) - )); + ); } } else { // Logged in CMS user with permissions to view file in the CMS - return DBField::create_field('HTMLText', sprintf( + return sprintf( '%s - %s', htmlspecialchars($name, ENT_QUOTES), htmlspecialchars($link, ENT_QUOTES), htmlspecialchars($title, ENT_QUOTES) - )); + ); } } - return false; + return ''; } /** diff --git a/templates/SilverStripe/UserForms/FormField/UserFormsCheckboxSetField.ss b/templates/SilverStripe/UserForms/FormField/UserFormsCheckboxSetField.ss index 52e691e9f..34400836d 100644 --- a/templates/SilverStripe/UserForms/FormField/UserFormsCheckboxSetField.ss +++ b/templates/SilverStripe/UserForms/FormField/UserFormsCheckboxSetField.ss @@ -1,7 +1,7 @@ <% if $Options.Count %> <% loop $Options %>