Skip to content

Commit

Permalink
Merge pull request #17 from 3Dgoo/feature/hide-model-admin-add-button
Browse files Browse the repository at this point in the history
Remove add button from ModelAdmin
  • Loading branch information
nyeholt authored Jan 24, 2018
2 parents 09fea7b + 3a1d59d commit db07d5f
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions code/controllers/DataChangeAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,22 @@
* @author [email protected]
* @license BSD License http://silverstripe.org/bsd-license/
*/
class DataChangeAdmin extends ModelAdmin {
public static $managed_models = array(
'DataChangeRecord',
);
class DataChangeAdmin extends ModelAdmin
{
public static $managed_models = array(
'DataChangeRecord',
);

public static $url_segment = 'datachanges';
public static $menu_title = 'Data Changes';
public static $url_segment = 'datachanges';
public static $menu_title = 'Data Changes';

public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id);
$gridField = $form->Fields()->fieldByName($this->modelClass);
$gridFieldConfig = $gridField->getConfig();
$gridFieldConfig->removeComponentsByType('GridFieldAddNewButton');

return $form;
}
}

0 comments on commit db07d5f

Please sign in to comment.