Custom Fields
Re-Envisioned
Support MB Relationships Single metabox on Reciprocal Relationship

This topic contains 3 replies, has 3 voices, and was last updated by  david.h 2 weeks, 3 days ago.

  • Creator
    Topic
  • #14412

    Clayton Collie
    Participant

    Hi Ahn,

    Until now, I have been using this plugin to relate an object in post type A with an object in post type B. This works great b/c the plugin creates a to and from metabox on each post type edit screen. I am now being ask if we can have a reciprocal relationship between two objects in the same post type. From the initial testing and reading the docs, both the to and from meta are being created. is there any way or do you have an idea of how to get it down to a single metabox when performing this type of relationship. I would be willing to submit a PR on github if we can talk through how this could be accomplished.

    My initial thought was to add a flag in the metabox registration like reciprocal => true and then that disables the default metabox output. Then you can insert the single metabox which is a combination of the two and from objects mashed together somehow. Does that sound like a good approach? What do you think? This is a must have for the platform I am building btw. Really appreciate your time.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #14416

    Anh Tran
    Keymaster

    Hi Clayton,

    Thanks a lot for your valuable feedback! I didn’t think about the 2 identical meta boxes appear on both sides (since it still works).

    I like the idea of adding reciprocal => true to the relationship. It’s simple and easy to understand. My additional thought might be we should let users define only one meta box instead of 2. Would you mind helping me on Github?

    #14417

    Clayton Collie
    Participant

    For sure. I was expecting to be a big part of it. I greatly appreciate you guiding the way. Let’s come up with a strategy and start a branch.

    #14425

    david.h
    Participant

    Hi Anh,

    I suggested a boolean for bi-directional (reciprocal) relationships in this post:

    https://metabox.io/support/topic/post-relationships/#post-7797

    Hope this helps,
    David

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.