Picking this up again after many years. Can I not use gridfield within the cms popup component? Here I have Ingredient entity and am wanting to add Ingredients from the db to a Recipe entity. Even a simple one doesn't appear.
Recipe.php
...
private static $db = [
'Title' => 'Varchar',
'Description' => 'Text',
];
private static $has_one = [];
private static $many_many = [
'Ingredients' => Ingredient::class,
];
public function getCMSFields_forPopup()
{
$gridConfig = GridFieldConfig_RelationEditor::create()->addComponents(
new GridFieldDeleteAction('unlinkrelation')
);
$grid = GridField::create(
'Ingredients',
'Ingredients',
$this->Ingredients(),
$gridConfig,
);
$fields = FieldList::create(
TextField::create('Title'),
TextareaField::create('Description'),
$grid
);
// or maybe something like..
// $fields->addFieldToTab('Main', 'Ingredients', 'Ingredients', $grid);
return $fields;
}