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

Admin Feature Request: Bi-Directional Related Field Type #4991

Closed
kellyannmcnamara01 opened this issue Sep 25, 2019 · 4 comments
Closed

Admin Feature Request: Bi-Directional Related Field Type #4991

kellyannmcnamara01 opened this issue Sep 25, 2019 · 4 comments

Comments

@kellyannmcnamara01
Copy link

Description

Ideally, it would be nice to have a bi-directional related field type.

Current situation

There is a product entry type that has a related category field. As a user enters products individually over time they are using the related category field on each product. A few months go by, and the user wants to change the products that are related to one category. If they go into that category they are unable to bulk products. Instead the user has to go to each individual product to edit the related category field.

If dreams came true [Ideally]

If a related category field is created in the products entry type, and a related products field in a category group, when you edit one, the other would reflect the relationships.

As an example, the user is entering products individually over time while using the related category field. Months go by and the user wants to bulk edit the products that are related to a specific category. The user would be able to go to the edit page of that category and in the related products field they would see the products that have been connected from the related category field in the products.

This would be in similar fashion to when a twig relatedTo() function is executed.

Brainstorming for how this might work

Understandably, this request will involve a lot of magic connecting two fields or having a new bi-directional field so to try and help out as much as possible here are some (maybe not great) concepts on potentially getting this to work.

  • Create one bi-directional field where you would pick two types of entries/assets/categories
  • Create two different relationship fields, but while creating the field allow for a connection to another field
  • ¯_(ツ)_/¯

Additional info

It's important to know that this would be a AX enhancement rather than a code enhancement. Also it is expected that if you add this bi-direction field to one entry type it would not automatically show up on the category edit page, but it would have to be added like any other field.

Also, I'm aware that there are plugins that currently show the relations, but if you have hundreds of products, having to go through each one is rather time consuming. And if the relationship is on the category side only, it is difficult for users to have to enter a product and edit an additional item every time.

@brandonkelly
Copy link
Member

This is a duplicate of #3907 - something we are going to look into for Craft 4 :)

@kellyannmcnamara01
Copy link
Author

This is awesome, thank you Brandon! Really excited about this being part of Craft 4.

Sorry I wasn't able to find that other ticket. I had searched for bi-directional, two-way, _both directions and two sided – but I hadn't thought of both sides.

@brandonkelly
Copy link
Member

brandonkelly commented Sep 26, 2019

Haha, I ended up finding it by way of #4682 :)

@kellyannmcnamara01
Copy link
Author

hahaha, nice trick!

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