SilverSmith icon indicating copy to clipboard operation
SilverSmith copied to clipboard

ENHANCEMENT: use GridfieldConfig_RelationEditor for manymany relationships

Open wernerkrauss opened this issue 12 years ago • 3 comments

When managing manymany Relations using

GridFieldConfig_RelationEditor::create()

instead of

GridFieldConfig_RecordEditor::create()

would be great.

wernerkrauss avatar Apr 09 '13 13:04 wernerkrauss

In the meanwhile this works as a workaround:

    public function getCMSFields() {
        $fields = $this->getGeneratedCMSFields();
                $gridConf = GridFieldConfig_RelationEditor::create();

                $fields->dataFieldByName('MyManyManyRelationship')->setConfig($gridConf);

        return $fields;
    }

But out of the box it's really nicer ;)

wernerkrauss avatar Apr 09 '13 13:04 wernerkrauss

Cool idea! What does RelationEditor do, exactly?

aaron_carlino: { webdeveloper, www.leftandmain.com }

On Tuesday, April 9, 2013 at 9:35 AM, wernerkrauss wrote:

In the meanwhile this works as a workaround: public function getCMSFields() { $fields = $this->getGeneratedCMSFields(); $gridConf = GridFieldConfig_RelationEditor::create(); $fields->dataFieldByName('MyManyManyRelationship')->setConfig($gridConf); return $fields; }

But out of the box it's really nicer ;)

— Reply to this email directly or view it on GitHub (https://github.com/unclecheese/SilverSmith/issues/10#issuecomment-16112634).

unclecheese avatar Apr 12 '13 19:04 unclecheese

Hi unclecheese,

according to http://doc.silverstripe.org/framework/en/reference/grid-field#gridfieldconfig-relationeditor it adds an interface for linking existing dataobjects to a manymany relationship or unlink them. It's just some more features than RecordEditor.

I had also to tweak the searchable_fields of the DO to overcome the "Title:StartsWidth" search which is IMHO a limitation.

wernerkrauss avatar Apr 13 '13 09:04 wernerkrauss