Merge pull request #799 from creative-commoners/pulls/5.2/double-escaped-html

FIX Submitted form field values are no longer double escaped in the CMS
This commit is contained in:
Dylan Wagstaff 2018-08-27 12:42:11 +12:00 committed by GitHub
commit 76540d8ffc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,9 @@
namespace SilverStripe\UserForms\Model\Submission;
use SilverStripe\ORM\DataObject;
use SilverStripe\UserForms\Model\Submission\SubmittedForm;
use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\Security\Member;
use SilverStripe\UserForms\Model\EditableFormField;
/**
* Data received from a UserDefinedForm submission
@ -27,10 +29,6 @@ class SubmittedFormField extends DataObject
'FormattedValue' => 'Value'
];
private static $casting = [
'FormattedValue' => 'HTMLFragment'
];
private static $table_name = 'SubmittedFormField';
/**
@ -76,20 +74,20 @@ class SubmittedFormField extends DataObject
/**
* Generate a formatted value for the reports and email notifications.
* Converts new lines (which are stored in the database text field) as
* <brs> so they will output as newlines in the reports
* <brs> so they will output as newlines in the reports.
*
* @return string
* @return DBField
*/
public function getFormattedValue()
{
return nl2br($this->dbObject('Value')->ATT());
return $this->dbObject('Value');
}
/**
* Return the value of this submitted form field suitable for inclusion
* into the CSV
*
* @return Text
* @return DBField
*/
public function getExportValue()
{