Silverstripe 3.1更改Gridfield Add按钮的默认按钮文本?

时间:2015-03-21 14:45:16

标签: silverstripe

如何更改Gridfield添加按钮的默认按钮文字? 我想这与->getConfig()有关,有什么想法吗?

1 个答案:

答案 0 :(得分:5)

通过以下示例之一更改“网格域添加”按钮的默认按钮文本:

//$gridfield = ..... // define you gridfield as normal first...then
$gridfield->getConfig()->getComponentByType('GridFieldAddNewButton')->setButtonName('Add Extra Product Gallery Images');

或者将其添加到您的数据对象:

static $singular_name = "Add Extra Product Gallery Image";
static $plural_name = "Add Extra Product Gallery Images";