Created
August 25, 2015 05:31
-
-
Save muskie9/924779d18a3996be2409 to your computer and use it in GitHub Desktop.
This file contains 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 | |
public function getEditForm($id = null, $fields = null) { | |
$form = parent::getEditForm($id, $fields); | |
// $gridFieldName is generated from the ModelClass, eg if the Class 'Product' | |
// is managed by this ModelAdmin, the GridField for it will also be named 'Product' | |
$gridFieldName = $this->sanitiseClassName($this->modelClass); | |
if($gridFieldName=='Speaker'){ | |
$gridField = $form->Fields()->fieldByName($gridFieldName); | |
$gridField->getConfig()->addComponent(new GridFieldOrderableRows()); | |
} | |
$form | |
->Fields() | |
->fieldByName($this->sanitiseClassName($this->modelClass)) | |
->getConfig() | |
->removeComponentsByType('GridFieldEditButton') | |
->removeComponentsByType('GridFieldDeleteAction') | |
->removeComponentsByType('GridFieldDetailForm') | |
->addComponent(new GridFieldDetailFormCustom()) | |
->addComponent(new GridFieldCopyButton()) | |
->addComponent(new GridFieldEditButton()) | |
->addComponent(new GridFieldDeleteAction()) | |
; | |
return $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment