src/Forms/FormScaffolder.php
public static function addManyManyRelationshipFields(
        FieldList &$fields,
        $relationship,
        $overrideFieldClass,
        $tabbed,
        DataObject $dataObject
    ) {
        if ($tabbed) {
            $fields->findOrMakeTab(
                "Root.$relationship",
                $dataObject->fieldLabel($relationship)
            );
        }

        $fieldClass = $overrideFieldClass ?: GridField::class;

        /** @var GridField $grid */
        $grid = Injector::inst()->create(
            $fieldClass,
            $relationship,
            $dataObject->fieldLabel($relationship),
            $dataObject->$relationship(),
            GridFieldConfig_RelationEditor::create()
        );

        if ($tabbed) {
            $fields->addFieldToTab("Root.$relationship", $grid);
        } else {
            $fields->push($grid);
        }
    }
public static function addManyManyRelationshipFields(
        FieldList &$fields,
        $relationship,
        $overrideFieldClass,
        $tabbed,
        DataObject $dataObject
    ) {
        if ($tabbed) {
            $fields->findOrMakeTab(
                "Root.$relationship",
                $dataObject->fieldLabel($relationship)
            );
        }

        $fieldClass = $overrideFieldClass ?: GridField::class;

        /** @var GridField $grid */
        $grid = Injector::inst()->create(
            $fieldClass,
            $relationship,
            $dataObject->fieldLabel($relationship),
            $dataObject->$relationship(),
            GridFieldConfig_RelationEditor::create()
        );

        if ($tabbed) {
            $fields->addFieldToTab("Root.$relationship", $grid);
        } else {
            $fields->push($grid);
        }
    }
public static function addManyManyRelationshipFields ( FieldList & $ fields , $ relationship , $ overrideFieldClass , $ tabbed , DataObject $ dataObject ) { if ( $ tabbed ) { $ fields -> findOrMakeTab ( "Root.$relationship" , $ dataObject -> fieldLabel ( $ relationship ) ) ; } $ fieldClass = $ overrideFieldClass ? : GridField :: class ; /** @var GridField $grid */ $ grid = Injector :: inst ( ) -> create ( $ fieldClass , $ relationship , $ dataObject -> fieldLabel ( $ relationship ) , $ dataObject -> $ relationship ( ) , GridFieldConfig_RelationEditor :: create ( ) ) ; if ( $ tabbed ) { $ fields -> addFieldToTab ( "Root.$relationship" , $ grid ) ; } else { $ fields -> push ( $ grid ) ; } }
Adds the default many-many relation fields for the relationship provided.

@param FieldList $fields Reference to the @FieldList to add fields to.
@param string $relationship The relationship identifier.
@param mixed $overrideFieldClass Specify the field class to use here or leave as null to use default.
@param bool $tabbed Whether this relationship has it's own tab or not.
@param DataObject $dataObject The @DataObject that has the relation.
Adds the default many - many relation fields for the relationship provided .