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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

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


Go to End


1164 Views

Avatar
vxd

Community Member, 19 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;