mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Using separate template for readonly version of Textarea (mainly to avoid SSViewer bugs, but also for more granular customisation)
This commit is contained in:
parent
a6148c33da
commit
475f3764c3
@ -62,6 +62,10 @@ class TextareaField extends FormField {
|
|||||||
return parent::Field($properties);
|
return parent::Field($properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTemplate() {
|
||||||
|
return ($this->isReadonly()) ? "{$this->template}_Readonly" : $this->template;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a readonly transformation on this field. You should still be able
|
* Performs a readonly transformation on this field. You should still be able
|
||||||
* to copy from this field, and it should still send when you submit
|
* to copy from this field, and it should still send when you submit
|
||||||
|
@ -1,5 +1 @@
|
|||||||
<% if isReadonly %>
|
<textarea id="$ID" class="textarea$extraClass" name="$Name" rows="$Rows" cols="$Cols"<% if isDisabled %> disabled<% end_if %>>$Value</textarea>
|
||||||
<span id="$ID" class="readonly$extraClass" name="$Name"><% if Value %>$Value<% else %><em>(<% _t('NONE', 'none') %>)</em><% end_if %></span>
|
|
||||||
<% else %>
|
|
||||||
<textarea id="$ID" class="textarea$extraClass" name="$Name" rows="$Rows" cols="$Cols"<% if isDisabled %> disabled<% end_if %>>$Value</textarea>
|
|
||||||
<% end_if %>
|
|
1
templates/forms/TextareaField_Readonly.ss
Normal file
1
templates/forms/TextareaField_Readonly.ss
Normal file
@ -0,0 +1 @@
|
|||||||
|
<span id="$ID" class="readonly$extraClass" name="$Name"><% if Value %>$Value<% else %><em>(<% _t('NONE', 'none') %>)</em><% end_if %></span>
|
Loading…
Reference in New Issue
Block a user