Resources: SilverStripe

Remove Add button from GridField

19 February 2014

Sometimes you need to be able to edit and delete GridField records, but you don't want the big green "Add New Object" button at the top. Here's how you remove it:

$config = GridFieldConfig_RecordEditor::create();
$config->removeComponentsByType($config->getComponentByType('GridFieldAddNewButton'));

Tags: , ,

Let's work together