mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 15:05:39 +00:00
Make the title and fragment configurable.
This commit is contained in:
parent
7061dc402b
commit
8f10ed4924
@ -7,6 +7,7 @@ class GridFieldAddExistingSearchButton implements
|
|||||||
GridField_HTMLProvider,
|
GridField_HTMLProvider,
|
||||||
GridField_URLHandler {
|
GridField_URLHandler {
|
||||||
|
|
||||||
|
protected $title;
|
||||||
protected $fragment;
|
protected $fragment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,12 +15,42 @@ class GridFieldAddExistingSearchButton implements
|
|||||||
*/
|
*/
|
||||||
public function __construct($fragment = 'buttons-before-left') {
|
public function __construct($fragment = 'buttons-before-left') {
|
||||||
$this->fragment = $fragment;
|
$this->fragment = $fragment;
|
||||||
|
$this->title = _t('GridFieldExtensions.ADDEXISTING', 'Add Existing');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTitle() {
|
||||||
|
return $this->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $title
|
||||||
|
*/
|
||||||
|
public function setTitle($title) {
|
||||||
|
$this->title = $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFragment() {
|
||||||
|
return $this->fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $fragment
|
||||||
|
*/
|
||||||
|
public function setFragment($fragment) {
|
||||||
|
$this->fragment = $fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHTMLFragments($grid) {
|
public function getHTMLFragments($grid) {
|
||||||
GridFieldExtensions::include_requirements();
|
GridFieldExtensions::include_requirements();
|
||||||
|
|
||||||
$data = new ArrayData(array(
|
$data = new ArrayData(array(
|
||||||
|
'Title' => $this->getTitle(),
|
||||||
'Link' => $grid->Link('add-existing-search')
|
'Link' => $grid->Link('add-existing-search')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<a href="$Link" class="ss-ui-button ui-button add-existing-search" data-icon="magnifier">
|
<a href="$Link" class="ss-ui-button ui-button add-existing-search" data-icon="magnifier">
|
||||||
<% _t("ADDEXISTING", "Add Existing") %>
|
$Title
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user