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

Controlling link type per field #15

Closed
maxime-rainville opened this issue Nov 23, 2020 · 2 comments
Closed

Controlling link type per field #15

maxime-rainville opened this issue Nov 23, 2020 · 2 comments

Comments

@maxime-rainville
Copy link

maxime-rainville commented Nov 23, 2020

Story

As a Developer I want the ability to control what Link Type are accepted on a given Link Field so that I can prevent user from selecting nonsensical link type.

Acceptance criteria

  • Individual LinkField have a configuration option to exclude/include specific link type.
  • Link type are auto detected from the child class of Link.
  • "Link Registry" concept is removed.

Note

  • A good approch to implementing this is that possible link types are passed as props on the React component rather than an GraphQL query. AnyFiled has a good example of this implementation.
  • The current implementation passes link type via a GraphQL query that can not be customised for individual links.
  • There's a implementation of the allow/deny link type on the gorriecoe/silverstripe-linkfield module.

Things that were considered and rejected

  • LinkField that point to a relation with a specific Link Type only accept this Type
  • Allow specific link type to be turn off by default

Pull requests

@maxime-rainville
Copy link
Author

I think removing registry through this card makes a lot of sense because managing possible link type is intertwined with controlling what type of links can be created via a specific field.

AnyField does the "Possible link types are passed as props on the React component" pretty well I think. So we should look there for inspiration.

I'm not sure about those two ACs.

  • (LinkField that point to a relation with a specific Link Type only accept this Type)
    • That's very intuitive for the developer, but getting AnyField to autodetech relationship type was a massive pain on the back side.
  • (Allow specific link type to be turn off by default)
    • The idea here is that maybe you have a very esoteric LinkType that most LinkField shouldn't accept.

@maxime-rainville
Copy link
Author

All done.

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