Clean up SilverStripe ModelAdmin (no sidebar, no filter, no import, no print)
Last active
October 11, 2017 13:47
-
-
Save Zauberfisch/8446634 to your computer and use it in GitHub Desktop.
Clean up SilverStripe ModelAdmin (no sidebar, no filter, no import, no print)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# See http://doc.silverstripe.org/framework/en/topics/configuration | |
# Caution: Indentation through two spaces, not tabs | |
Name: mysite | |
After: 'framework/*','cms/*' | |
--- | |
LeftAndMain: | |
extra_requirements_css: | |
- 'mysite/css/cms.css' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyModelAdmin extends ModelAdmin { | |
private static $managed_models = array( | |
'MyModel', | |
); | |
private static $url_segment = 'mymodeladmin'; | |
public function getEditForm($id = null, $fields = null) { | |
$form = parent::getEditForm($id, $fields); | |
foreach ($form->Fields() as $field) { | |
if ($field->is_a('GridField')) { | |
$field->getConfig()->removeComponentsByType('GridFieldExportButton'); | |
$field->getConfig()->removeComponentsByType('GridFieldPrintButton'); | |
} | |
} | |
return $form; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.MyModelAdmin #cms-content-tools-ModelAdmin { | |
display: none !important; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment