Skip to content

Instantly share code, notes, and snippets.

@sunnysideup
Last active October 12, 2018 20:10
Show Gist options
  • Save sunnysideup/8d5a0a3dd35cf95b4f8dfab00f845f7f to your computer and use it in GitHub Desktop.
Save sunnysideup/8d5a0a3dd35cf95b4f8dfab00f845f7f to your computer and use it in GitHub Desktop.
Fixing ModelAdmin in CWP 2.1
---
Name: cwp-hacks
---
SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor:
extensions:
- GridFieldConfig_RecordEditor_Fix
<?php
use SilverStripe\Core\Extension;
use SilverStripe\Forms\GridField\GridField_ActionMenu;
use SilverStripe\Forms\GridField\GridFieldDeleteAction;
class GridFieldConfig_RecordEditor_Fix extends Extension
{
function updateConfig()
{
$this->owner->removeComponentsByType(GridFieldDeleteAction::class);
$this->owner->removeComponentsByType(GridField_ActionMenu::class);
$this->owner->addComponent(new GridFieldDeleteAction());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment