3

by default the CRUD add button name is the same as model name. how can we change that?

$tabs->addTab('Users')->add('CRUD')->setModel('Admin_User');
webelizer
  • 316
  • 1
  • 11

3 Answers3

4

If you can - first set the model caption properly

Set $model->$caption of your model.

If it's just the CRUD which needs to have custom button name, then

Set $crud->entity_name either by extending or by specifying second parameter to add('CRUD')

Finally if you want to change it after crud->setModel()

You can access button through $crud->add_button, and use either set() or setLabel().

romaninsh
  • 10,068
  • 4
  • 46
  • 70
  • in the third way, when I click the btn it shows this error: Fatal error: Call to a member function set() on a non-object in C:\wamp\www\test\page\admin.php on line 20 – webelizer Sep 20 '13 at 18:57
  • `$crud->add_button->set('Text to be shown at Add button');` and `setLabel()` don't work for me too – Kostiantyn Sep 22 '13 at 06:45
  • `$crud->add_button->set()` must be added after `$crud->setModel()` It works! – Kostiantyn Sep 23 '13 at 07:59
2
$tab = $tabs->addTab('Users');
$crud = $tab->add('CRUD');
$crud->setModel('Admin_User');
$crud->entity_name = 'Text to be shown at Add button';

Or

$tab = $tabs->addTab('Users');
$crud = $tab->add('CRUD');
$crud->setModel('Admin_User');
$crud->add_button->set('Text to be shown at Add button');
Vadym
  • 751
  • 3
  • 15
2

OR

$this->add('CRUD',array('entity_name' => 'Text to be shown at Add button'));
Kostiantyn
  • 1,148
  • 10
  • 15