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,10 +16,10 @@ class SubmittedFileField extends SubmittedFormField {
|
|||||||
*
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
function getValue() {
|
function getFormattedValue() {
|
||||||
return '<a href="'.$this->getLink().'">'. _t('SubmittedFileField.DOWNLOADFILE', 'Download File') .'</a>';
|
return '<a href="'.$this->getLink().'">'. _t('SubmittedFileField.DOWNLOADFILE', 'Download File') .'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Link object for this field
|
* Return the Link object for this field
|
||||||
*
|
*
|
||||||
|
@ -16,5 +16,15 @@ class SubmittedFormField extends DataObject {
|
|||||||
static $has_one = array(
|
static $has_one = array(
|
||||||
"Parent" => "SubmittedForm"
|
"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 %>
|
<% control FieldValues %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="field">$Title</td>
|
<td class="field">$Title</td>
|
||||||
<td class="value">$Value.RAW</td>
|
<td class="value">$FormattedValue</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end_control %>
|
<% end_control %>
|
||||||
</table>
|
</table>
|
||||||
|
@ -6,7 +6,7 @@ $Body
|
|||||||
<dl>
|
<dl>
|
||||||
<% control Fields %>
|
<% control Fields %>
|
||||||
<dt><strong><% if Title %>$Title<% else %>$Name<% end_if %></strong></dt>
|
<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 %>
|
<% end_control %>
|
||||||
</dl>
|
</dl>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
Loading…
Reference in New Issue
Block a user