Gridfield and GridfieldFormDetail

Reading this: https://docs.silverstripe.org/en/5/developer_guides/model/managing_records/ there is this line:

" There is a CMSEditLinkExtension specifically for the purpose of generating links to the edit forms of records. It operates on the assumption that your record is being edited in a GridFieldDetailForm in some GridField (be it on another record or in a ModelAdmin)."

So I think I need a GridFieldDetailForm but I’m not too sure how it works.

I can see that GridField extends FormField and GridFieldDetailForm extends AbstractGridFieldComponent implements GridField_URLHandler which implements implements GridFieldComponent.

So a GridFieldDetailForm is not a subclass(type) of GridField at all but a Component of a GridField? How is a GridFieldDetailForm used?

Very rough example for discussion purposes: we create a GridField and create/get a config: (plagiarising outrageously from the tutorials for demonstration purposes)


class MyPage extends Page
{
public function getCMSFields()
{
$fields = parent::getCMSFields();

    $fields->addFieldToTab(
        'Root.Pages',
        $grid = GridField::create('Pages', 'All pages', SiteTree::get())
    );

    // GridField configuration

// I have me one of these
$config = GridFieldConfig_RecordEditor::create();

// add GridFieldDetailForm here??? Or is it already bundled in the Record_editor?
$gfdf = GridFieldDetailForm::create();

// do we need to tell the GridFieldDetailForm anything about our data? Eg, fieldlist? Or will it do it by itself?

$config->addComponent($gfdf);

$gridField->setConfig($config);


Thanks!

The reason for all of this is I am trying to solve an incorrect link in the CMS breadcrumbs to the various has_one relationships higher up, I am hoping that the GridFieldDetailForm will fix this issue. (class=“cms-panel-link crumb” )