elliot-sawyer / silverstripe-linkfield

Adds a Linkfield for gorriecoe/silverstripe-link
BSD 3-Clause "New" or "Revised" License
9 stars 25 forks source link

linking vs deleting inconsistent between has_one vs has_many #23

Closed GuySartorelli closed 3 years ago

GuySartorelli commented 4 years ago

The has_one field uses linking and unlinking - you cannot completely delete a link object in the has_one field without altering that field.

The has_many/many_many field doesn't allow linking to existing links at all, and deleting a link here does delete the object.

I'm working on a pull request to address #1 right now so I'd be happy to make these consistent at the same time - just let me know how you'd like this to work. The options as I see them:

  1. Leave it as is
  2. Replace the unlink button on the has_one field with a delete button, and remove the option for linking to existing objects.
  3. Add the ability to link to existing items in the many field, and replace the delete button here with an unlink button.
  4. Make this configurable, so the user can specify whether linking/unlinking should be possible, or if pure deletion is preferred.
    1. In this case, either 2 or 3 should be specified as a default, so the default is always consistent between fields of different relationship types.

Let me know what you prefer and I'll add it into the pull request I'm putting together.