Skip to content

Instantly share code, notes, and snippets.

@kinglozzer
Created May 12, 2015 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinglozzer/be282971b161b062f9f9 to your computer and use it in GitHub Desktop.
Save kinglozzer/be282971b161b062f9f9 to your computer and use it in GitHub Desktop.
<?php
class SomeModelAdmin extends ModelAdmin {
private static $managed_models = array(
"MyDataObject"
);
public function getEditForm($id = null, $fields = null) {
$form = parent::getEditForm($id, $fields);
$gridField = $form->Fields()->dataFieldByName('MyDataObject');
$detailForm = $gridField->getConfig()->getComponentByType('GridFieldDetailForm');
$detailForm->setItemEditFormCallback(function($form) use ($self) {
// You can use $form in here
});
return $form;
}
}
@rista86
Copy link

rista86 commented May 13, 2015

This morning I get a different idea. Since I only wanted to add extra class on form, I actually get the Tab that I'm on and add class there. It work like a charm, so no need to wrap fields or doing anything. Thank you for your help btw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment