mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
APICHANGE SSF-53 : add ability to set an customised class of icons for a GridField_Action button
This commit is contained in:
parent
929182f818
commit
3ef957b704
@ -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(),
|
||||
));
|
||||
|
||||
|
@ -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>
|
Loading…
Reference in New Issue
Block a user