From fc26c64f63957696057f9b36e5ad6b27faf649d1 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 15 Sep 2007 00:18:21 +0000 Subject: [PATCH] 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 --- forms/InlineFormAction.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/forms/InlineFormAction.php b/forms/InlineFormAction.php index e18778d79..d0e5f89a9 100755 --- a/forms/InlineFormAction.php +++ b/forms/InlineFormAction.php @@ -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 "name}\" value=\"{$this->title}\" id=\"{$this->id()}\" class=\"action$extraClass\" />"; + return "name}\" value=\"{$this->title}\" id=\"{$this->id()}\" class=\"action{$this->extraClass}\" />"; } function Title() {