[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
- This topic has 5 replies, 2 voices, and was last updated 2 years, 3 months ago by
Kevin.
-
AuthorPosts
-
July 19, 2023 at 4:20 PM #42652
Kevin
ParticipantHi 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 : radioWaht 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,
KLJuly 19, 2023 at 9:45 PM #42669Kevin
Participanthi 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 !July 20, 2023 at 1:28 PM #42681Kevin
ParticipantHi,
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 !
July 20, 2023 at 2:36 PM #42683Kevin
ParticipantJuly 20, 2023 at 10:47 PM #42701Peter
ModeratorHello,
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.
July 20, 2023 at 11:03 PM #42703Kevin
ParticipantHello 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 -
AuthorPosts
- You must be logged in to reply to this topic.