mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
APICHANGE: added getFormattedValue() for UDF submitted form fields to allow subclasses to overload the stored content. BUGFIX: convert newlines from text submissions to br tags so textarea fields actually come out semi readable
This commit is contained in:
parent
3257590dc8
commit
fd0fe1b01d
@ -16,7 +16,7 @@ class SubmittedFileField extends SubmittedFormField {
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
function getValue() {
|
||||
function getFormattedValue() {
|
||||
return '<a href="'.$this->getLink().'">'. _t('SubmittedFileField.DOWNLOADFILE', 'Download File') .'</a>';
|
||||
}
|
||||
|
||||
|
@ -17,4 +17,14 @@ class SubmittedFormField extends DataObject {
|
||||
"Parent" => "SubmittedForm"
|
||||
);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
function getFormattedValue() {
|
||||
return nl2br($this->dbObject('Value')->RAW());
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
<% control FieldValues %>
|
||||
<tr>
|
||||
<td class="field">$Title</td>
|
||||
<td class="value">$Value.RAW</td>
|
||||
<td class="value">$FormattedValue</td>
|
||||
</tr>
|
||||
<% end_control %>
|
||||
</table>
|
||||
|
@ -6,7 +6,7 @@ $Body
|
||||
<dl>
|
||||
<% control Fields %>
|
||||
<dt><strong><% if Title %>$Title<% else %>$Name<% end_if %></strong></dt>
|
||||
<dd style="margin: 4px 0 14px 0">$Value.RAW</dd>
|
||||
<dd style="margin: 4px 0 14px 0">$FormattedValue</dd>
|
||||
<% end_control %>
|
||||
</dl>
|
||||
<% end_if %>
|
||||
|
Loading…
Reference in New Issue
Block a user