Make the title and fragment configurable.

This commit is contained in:
ajshort 2013-02-16 22:59:29 +11:00
parent 7061dc402b
commit 8f10ed4924
2 changed files with 32 additions and 1 deletions

View File

@ -7,6 +7,7 @@ class GridFieldAddExistingSearchButton implements
GridField_HTMLProvider,
GridField_URLHandler {
protected $title;
protected $fragment;
/**
@ -14,12 +15,42 @@ class GridFieldAddExistingSearchButton implements
*/
public function __construct($fragment = 'buttons-before-left') {
$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) {
GridFieldExtensions::include_requirements();
$data = new ArrayData(array(
'Title' => $this->getTitle(),
'Link' => $grid->Link('add-existing-search')
));

View File

@ -1,3 +1,3 @@
<a href="$Link" class="ss-ui-button ui-button add-existing-search" data-icon="magnifier">
<% _t("ADDEXISTING", "Add Existing") %>
$Title
</a>