Skip to content

Instantly share code, notes, and snippets.

@kinglozzer
Created March 23, 2017 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kinglozzer/be191c6e7adec3741c43cf7fc7f7de83 to your computer and use it in GitHub Desktop.
Save kinglozzer/be191c6e7adec3741c43cf7fc7f7de83 to your computer and use it in GitHub Desktop.
<?php
$gridField = GridField::create('...etc');
$parentID = $this->ID;
$detailForm = $gridField->getConfig()->getComponentByType('GridFieldDetailForm');
$detailForm->setItemEditFormCallback(function($form) use ($parentID) {
$form->Fields()->dataFieldByName('ParentID')->setValue($parentID);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment