From 3ef957b70465e68754043e2166cbfd5e9f3b05db Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Mon, 5 Mar 2012 15:40:12 +1300 Subject: [PATCH] APICHANGE SSF-53 : add ability to set an customised class of icons for a GridField_Action button --- forms/gridfield/GridField.php | 16 ++++++++++++++++ templates/Includes/GridField_Action.ss | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/forms/gridfield/GridField.php b/forms/gridfield/GridField.php index b2f574727..6714edf77 100755 --- a/forms/gridfield/GridField.php +++ b/forms/gridfield/GridField.php @@ -663,6 +663,7 @@ class GridField_Action extends FormAction { * @var string */ protected $buttonLabel; + protected $buttonIcon; /** * @@ -712,6 +713,20 @@ class GridField_Action extends FormAction { public function _nameEncode($match) { return '%'.dechex(ord($match[0])); } + + /** + * buttonIcon setter + */ + public function setButtonIcon($iconName) { + $this->buttonIcon = $iconName; + } + + /** + * buttonIcon getter + */ + public function getButtonIcon(){ + return $this->buttonIcon; + } /** * Default method used by Templates to render the form @@ -748,6 +763,7 @@ class GridField_Action extends FormAction { 'Name' => 'action_gridFieldAlterAction'. '?' . http_build_query($actionData), 'Disabled' => $this->isReadonly(), 'Label' => $this->buttonLabel, + 'Icon' => $this->buttonIcon, 'DataURL' => $this->gridField->Link(), )); diff --git a/templates/Includes/GridField_Action.ss b/templates/Includes/GridField_Action.ss index 0d8b4787d..28c154f2e 100644 --- a/templates/Includes/GridField_Action.ss +++ b/templates/Includes/GridField_Action.ss @@ -1 +1,3 @@ - \ No newline at end of file + \ No newline at end of file