mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
16982ba17c
* Alter Grid Field "Add New" Button to take the name of the table (i.e. "Add Member") * Alter table names in security section to be singular so the button text makes sense
26 lines
741 B
PHP
26 lines
741 B
PHP
<?php
|
|
/**
|
|
* This component provides a button for opening the add new form provided by {@link GridFieldDetailForm}.
|
|
*
|
|
* @package framework
|
|
* @subpackage gridfield
|
|
*/
|
|
class GridFieldAddNewButton implements GridField_HTMLProvider {
|
|
protected $targetFragment;
|
|
|
|
public function __construct($targetFragment = 'before') {
|
|
$this->targetFragment = $targetFragment;
|
|
}
|
|
|
|
public function getHTMLFragments($gridField) {
|
|
$data = new ArrayData(array(
|
|
'NewLink' => Controller::join_links($gridField->Link('item'), 'new'),
|
|
'ButtonName' => _t('GridField.Add', 'Add') . ' ' . _t('GridField.' . $gridField -> name, $gridField -> name),
|
|
));
|
|
return array(
|
|
$this->targetFragment => $data->renderWith('GridFieldAddNewbutton'),
|
|
);
|
|
}
|
|
|
|
}
|