Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENHANCEMENT: use GridfieldConfig_RelationEditor for manymany relationships #10

Open
wernerkrauss opened this issue Apr 9, 2013 · 3 comments

Comments

@wernerkrauss
Copy link
Contributor

When managing manymany Relations using

GridFieldConfig_RelationEditor::create()

instead of

GridFieldConfig_RecordEditor::create()

would be great.

@wernerkrauss
Copy link
Contributor Author

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 ;)

@unclecheese
Copy link
Owner

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 (#10 (comment)).

@wernerkrauss
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants