mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Fixed FormAction.ss template when used with <button> tag
This commit is contained in:
parent
fd847dda4d
commit
454b89f2bb
@ -32,16 +32,7 @@ class FormAction extends FormField {
|
||||
*/
|
||||
public $useButtonTag = false;
|
||||
|
||||
private $buttonContent = null;
|
||||
|
||||
/**
|
||||
* Add content inside a button field.
|
||||
*/
|
||||
function setButtonContent($content) {
|
||||
$this->buttonContent = (string) $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected $buttonContent = null;
|
||||
|
||||
/**
|
||||
* Create a new action button.
|
||||
@ -76,7 +67,7 @@ class FormAction extends FormField {
|
||||
$properties,
|
||||
array(
|
||||
'Name' => $this->action,
|
||||
'Title' => ($this->description) ? $this->description : $this->Title(),
|
||||
'Title' => ($this->description && !$this->useButtonTag) ? $this->description : $this->Title(),
|
||||
'UseButtonTag' => $this->useButtonTag
|
||||
)
|
||||
);
|
||||
@ -93,11 +84,27 @@ class FormAction extends FormField {
|
||||
array(
|
||||
'disabled' => ($this->isReadonly() || $this->isDisabled()),
|
||||
'value' => $this->Title(),
|
||||
'type' => ($this->useButtonTag) ? null : 'submit'
|
||||
'type' => ($this->useButtonTag) ? null : 'submit',
|
||||
'title' => ($this->useButtonTag) ? $this->description : null,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add content inside a button field.
|
||||
*/
|
||||
function setButtonContent($content) {
|
||||
$this->buttonContent = (string) $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String
|
||||
*/
|
||||
function getButtonContent() {
|
||||
return $this->buttonContent;
|
||||
}
|
||||
|
||||
function extraClass() {
|
||||
return 'action ' . parent::extraClass();
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
<% if UseButtonTag %>
|
||||
<button $AttributesHTML></button>
|
||||
<button $AttributesHTML>
|
||||
<% if ButtonContent %>$ButtonContent<% else %>$Title<% end_if %>
|
||||
</button>
|
||||
<% else %>
|
||||
<input $AttributesHTML>
|
||||
<% end_if %>
|
Loading…
x
Reference in New Issue
Block a user