-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathModuleAdmin.php
More file actions
executable file
·31 lines (22 loc) · 974 Bytes
/
ModuleAdmin.php
File metadata and controls
executable file
·31 lines (22 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
namespace Jaedb\ModuleManager;
use SilverStripe\Admin\ModelAdmin;
use SilverStripe\Forms\GridField\GridFieldAddNewButton;
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClass;
class Admin extends ModelAdmin {
private static $url_segment = 'modules';
private static $menu_title = 'Modules';
private static $menu_icon_class = 'font-icon-edit-list';
private static $managed_models = array(
Module::class
);
public function getEditForm($id = null, $fields = null){
$form = parent::getEditForm($id, $fields);
$gridFieldName = $this->sanitiseClassName(Module::class);
$gridField = $form->Fields()->fieldByName($gridFieldName);
// Swap out our "Add" button for the multiclass Add
$gridField->getConfig()->addComponent(new GridFieldAddNewMultiClass());
$gridField->getConfig()->removeComponentsByType(GridFieldAddNewButton::class);
return $form;
}
}