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
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $buttonLabel;
|
protected $buttonLabel;
|
||||||
|
protected $buttonIcon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -712,6 +713,20 @@ class GridField_Action extends FormAction {
|
||||||
public function _nameEncode($match) {
|
public function _nameEncode($match) {
|
||||||
return '%'.dechex(ord($match[0]));
|
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
|
* 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),
|
'Name' => 'action_gridFieldAlterAction'. '?' . http_build_query($actionData),
|
||||||
'Disabled' => $this->isReadonly(),
|
'Disabled' => $this->isReadonly(),
|
||||||
'Label' => $this->buttonLabel,
|
'Label' => $this->buttonLabel,
|
||||||
|
'Icon' => $this->buttonIcon,
|
||||||
'DataURL' => $this->gridField->Link(),
|
'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