Skip to content

Instantly share code, notes, and snippets.

@kinglozzer
Last active January 9, 2017 17:23
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/66e1b32c13f8276a8e8ea5bc1dc761ac to your computer and use it in GitHub Desktop.
Save kinglozzer/66e1b32c13f8276a8e8ea5bc1dc761ac to your computer and use it in GitHub Desktop.
<?php
class SomeModelAdmin extends ModelAdmin {
private static $managed_models = array(
"Member"
);
public function getEditForm($id = null, $fields = null) {
$form = parent::getEditForm($id, $fields);
$gridField = $form->Fields()->dataFieldByName('Member');
$gridField->setList($gridField->getList()->filter('Status', 'Customer'));
$fields->addFieldToTab(
'Root.Participants',
GridField::create(
'Participants',
'Participants',
Member::get()->filter('Status', 'Participant'),
GridFieldConfig_RecordEditor::create()
)
);
return $form;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment