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

UX: GridFieldConfig_RelationEditor 'steals' relation on has_many without warning #9620

Open
jonom opened this issue Jul 31, 2020 · 1 comment

Comments

@jonom
Copy link
Contributor

jonom commented Jul 31, 2020

Affected Version

4.6.0

Description

I noticed today that a CMS user probably can't tell the difference between a has_many and many_many Gridfield (using GridFieldConfig_RelationEditor) and thus likely wouldn't realise that the 'Link existing' function behaves differently depending on the type of relationship. I was caught off guard today thinking I was saving myself time by reusing content in a many_many relationship, but then realised it was a has_many when I saw that most of the 'holders' I was working on were empty.

A possible solution could be that if you select an item which is already linked to something else in a has_many relationship you could get a modal confirmation message like:

"That {Thing} is already linked to {Title of object}. Linking it to this {Thing} will unlink it from {Title of object}."

Cancel Duplicate instead Proceed

Related: WPP-Public/akqa-nz-silverstripe-menumanager#41

Steps to Reproduce

Use GridFieldConfig_RelationEditor on a has_many relation.

@jonom
Copy link
Contributor Author

jonom commented Nov 19, 2021

This came up on a project today and I implemented a little hack to just remove the 'link existing' field from GridFieldConfig_RelationEditor on has many lists, since I don't think it should be there. I customised GridFieldAddExistingAutocompleter::getHTMLFragments() with:

if ($gridField->list instanceof HasManyList) {
    return "";
}

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

No branches or pull requests

2 participants