Skip to content

Add many to many support for improved link editing #304

@mooror

Description

@mooror

Description

I was talking to @GuySartorelli over on the slack channel, and he suggested I open an issue for it, so here I am 😁

Request

I would like request many to many relationship support be added to this module so that link objects can be reused throughout the website.

Use case

On our websites we try our best to reduce the number of times we need to edit objects by making things reusable. In the case of links, this means that we create link objects (currently using the gorriecoe/silverstripe-link module) for external resources on the web and then reuse them throughout our website. Then, if that resource link ever changes or breaks, we only need to update one link object and not every place were that external URL was used.

We also use these reusable links for things like the main contact number and email for the company. We use them in headers (for call now and email now buttons) and the footer, and the contact us page. If at some point the company changes those, again we only have one place to update them.

Finally, we also use them for generic inner page links that might change. For example, a "Featured Event" link may in July link to one blog post URL, and then in August get updated to a different blog post URL.

One link object used multiple times allows us to reduce editing time and cut down on human error

Solution thoughts

Currently the single owner is needed in order for the can* permissions methods to inherit from their parent object, and for the onBeforeWrite() code that sets the sorting. As well as for any code that might use the Owner data.

For the permissions, I believe they currently fall back on the global dataobject permissions if their is no owner. Which I think works sufficiently (as the complexity level of trying to have inherited permissions with many_many seems pretty high).

I'm not sure what to suggest for the sorting code in onBeforeWrite()

Once the object itself supports many_many, the multiple field itself would need some kind of update to allow for existing links to be used. Perhaps similar to how the upload field allows you to select an existing file via a popup modal. Unfortunately I am not familiar with React, so I'm not much use in the technical area here

Disclaimer

I had to check the "You intend to implement the feature yourself *" checkbox to post this issue. And while I am willing to help if I can, I don't think I have the technical knowledge to implement it myself (especially in the React area). But I wanted to get some community feedback on this

Additional context or points of discussion

No response

Validations

  • You intend to implement the feature yourself
  • You have read the contributing guide
  • You strongly believe this feature should be in core, rather than being its own community module
  • You have checked for existing issues or pull requests related to this feature (and didn't find any)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions