APICHANGE SSF-53 : add ability to set an customised class of icons for a GridField_Action button

This commit is contained in:
Normann Lou 2012-03-05 15:40:12 +13:00
parent 929182f818
commit 3ef957b704
2 changed files with 19 additions and 1 deletions

View File

@ -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(),
));

View File

@ -1 +1,3 @@
<button id="$ID" class="$Class" name="$Name" type="submit" data-url="$DataURL"<% if Disabled %> disabled="disabled"<% end_if %>>$Label</button>
<button id="$ID" class="$Class" name="$Name" type="submit" data-url="$DataURL"<% if Disabled %> disabled="disabled"<% end_if %><% if Icon %> data-icon="$Icon"<% end_if %>>
$Label
</button>