[REQUEST] Create a set of custom fields that you can call from the builder

Support MB Builder [REQUEST] Create a set of custom fields that you can call from the builder

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #42652
    KevinKevin
    Participant

    Hi everyone @Metabox.io,

    Hope you're fine,

    I was wondering if there's any way to create a set of custom fields, and call this set to a new metabox.

    Here's an example :

    I've created a first metabox called 'Identification' with the following fields :
    - Name : text
    - Surname : text
    - Age : number
    - Gender : radio

    Waht i want to achieve is to call this set to a new metabox called "information", like this
    - Date : date
    - Place : text
    - Identification : the set i've created
    - another info : text
    etc ...

    Is this possible within MB builder ?
    it would be an awesome features when you have cross information between multiple posts.

    Have a nice day,
    KL

    #42669
    KevinKevin
    Participant

    hi again,

    i get to something with custom_html field and a callback, but it doesn't save anything at all.

    here's my callback for custom html :

    function my_custom_callback_metabox(){
        $meta_box_registry = rwmb_get_registry( 'meta_box' );
        $meta_box = $meta_box_registry->get( 'the_meta_box_i_callback' );
    
        //render the form
        return $meta_box->show();
    }

    if any of you have a clue,
    thanks again and have a nice day !

    #42681
    KevinKevin
    Participant

    Hi,

    figured it out, here's the function, if anyone need it. :

    function my_custom_callback_metabox( $saved, $field ){
        $added_registry = rwmb_get_registry( 'meta_box' );
        $added_meta_box = $added_registry->get( 'metabox_id' );
    
        $post_id = get_the_ID();
        $added_meta_box->object_id = $post_id;
        $added_meta_box->saved = $saved;
    
        return $added_meta_box->show();
    }

    I will pack it soon in a new field type, and repost it here. could be a great update !

    #42683
    KevinKevin
    Participant
    #42701
    PeterPeter
    Moderator

    Hello,

    Currently, it's not possible with the builder. But it's an interesting idea. I will forward this topic to the development team to consider implementing a feature to support a set of fields.

    #42703
    KevinKevin
    Participant

    Hello Peter,

    Thanks for your answer,

    You should check the link i provided : https://drive.google.com/file/d/1VhqhgDx9Qia2_gJrMlpVmtVgyTdsTe4g/view?usp=drive_link

    it's packed and ready to use :), all you have to do it's include it in functions.php

    A new field type called "include another mb" (include_mb) appears on builder (could be used in pure php as well), and provide a simple way to include a metabox to another metabox by letting you choose wich metabox you would like to include.

    BTW, it will need some improvements, so i let you forward this to the MB team,
    a simple mention if you choose to integrate it would be a nice move 🙂

    Happy to help,

    have a nice day,
    KL

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.