mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT Made use of createTag() on FormAction->Field()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64410 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
b042141634
commit
3e13bd8307
@ -55,14 +55,35 @@ class FormAction extends FormField {
|
||||
return $this->extraData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a submit input, or button tag
|
||||
* using {@link Form->createTag()} functionality.
|
||||
*
|
||||
* @return HTML code for the input OR button element
|
||||
*/
|
||||
function Field() {
|
||||
$titleAttr = $this->description ? "title=\"" . Convert::raw2att($this->description) . "\"" : '';
|
||||
if($this->useButtonTag) {
|
||||
return "<button class=\"action " . $this->extraClass() . "\" id=\"" . $this->id() . "\" type=\"submit\" name=\"$this->action\" $titleAttr />" . $this->attrTitle() . "</button>\n";
|
||||
} else {
|
||||
return "<input class=\"action " . $this->extraClass() . "\" id=\"" . $this->id() . "\" type=\"submit\" name=\"$this->action\" value=\"" . $this->attrTitle() . "\" $titleAttr />\n";
|
||||
}
|
||||
$attributes = array(
|
||||
'class' => 'action' . ($this->extraClass() ? (' ' . $this->extraClass()) : ''),
|
||||
'id' => $this->id(),
|
||||
'type' => 'submit',
|
||||
'name' => $this->action
|
||||
);
|
||||
|
||||
return $this->createTag('button', $attributes, $this->attrTitle());
|
||||
} else {
|
||||
$attributes = array(
|
||||
'class' => 'action' . ($this->extraClass() ? (' ' . $this->extraClass()) : ''),
|
||||
'id' => $this->id(),
|
||||
'type' => 'submit',
|
||||
'name' => $this->action,
|
||||
'value' => $this->attrTitle()
|
||||
);
|
||||
|
||||
if($this->description) $attributes['title'] = Convert::raw2att($this->description);
|
||||
|
||||
return $this->createTag('input', $attributes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user