Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

GridFieldConfig::create()->addComponents( Button name


Reply


287 Views

Avatar
vxd

Community Member, 16 Posts

8 November 2013 at 2:24pm

Hello,

I have read through the docs but I couldn't find anything.

I would like to replace the default button name for "GridFieldAddNewButton". At the moment it is "Add Gallery Object".

How can I replace it to "Add New"

There is a function SetButtonName but I don't know when to call it.
http://api.silverstripe.org/3.0/class-GridFieldAddNewButton.html

Here is the code

$gridFieldConfig = GridFieldConfig::create()->addComponents(
new GridFieldToolbarHeader(),
new GridFieldAddNewButton('toolbar-header-right'),
new GridFieldSortableHeader(),
new GridFieldDataColumns(),
new GridFieldPaginator(10),
new GridFieldEditButton(),
new GridFieldDeleteAction(),
new GridFieldDetailForm()
);
//public function __construct($name, $title = null, SS_List $dataList = null, GridFieldConfig $config = null) {
$gridField = new GridField("GalleryObject", "Images", $this->GalleryObjects(), $gridFieldConfig);

return $gridField;