elofgren: Add extraClass parameter to InlineFormAction? so that 'Delete Selected Files' button can have the 'delete' class assigned to it so it turns red on hover.

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41833 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-15 00:18:21 +00:00
parent e25d8bab65
commit fc26c64f63
1 changed files with 12 additions and 1 deletions

View File

@ -6,6 +6,17 @@
class InlineFormAction extends FormField {
protected $includeDefaultJS = true;
/**
* Create a new action button.
* @param action The method to call when the button is clicked
* @param title The label on the button
* @param extraClass A CSS class to apply to the button in addition to 'action'
*/
function __construct($action, $title = "", $extraClass = '') {
$this->extraClass = ' '.$extraClass;
parent::__construct($action, $title, null, null);
}
function performReadonlyTransformation() {
return new InlineFormAction_ReadOnly( $this->name, $this->title );
@ -16,7 +27,7 @@ class InlineFormAction extends FormField {
Requirements::javascriptTemplate('sapphire/javascript/InlineFormAction.js',array('ID'=>$this->id()));
}
return "<input type=\"submit\" name=\"action_{$this->name}\" value=\"{$this->title}\" id=\"{$this->id()}\" class=\"action$extraClass\" />";
return "<input type=\"submit\" name=\"action_{$this->name}\" value=\"{$this->title}\" id=\"{$this->id()}\" class=\"action{$this->extraClass}\" />";
}
function Title() {