cmb2_get_metabox_form

Retrieve a metabox form.

Description

(string) cmb2_get_metabox_form( (mixed) $meta_box, (int) $object_id = 0, (array) $args = array() ); 

Returns (string)

CMB2 html form markup

Parameters (3)

0. $meta_box (mixed)
Metabox config array or Metabox ID
1. $object_id — Optional. (int)
The object id.
2. $args — Optional. (array) => array()
Arguments array

Usage

  1. if ( !function_exists( 'cmb2_get_metabox_form' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'maps-builder/includes/libraries/metabox/includes/helper-functions.php'; 
  3.  
  4. // Metabox config array or Metabox ID 
  5. $meta_box = null; 
  6.  
  7. // The object id. 
  8. $object_id = -1; 
  9.  
  10. // Optional arguments array 
  11. $args = array(); 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = cmb2_get_metabox_form($meta_box, $object_id, $args); 
  15.  

Defined (2)

The function is defined in the following location(s).

/includes/libraries/metabox/includes/helper-functions.php  
  1. function cmb2_get_metabox_form( $meta_box, $object_id = 0, $args = array() ) { 
  2.  
  3. $object_id = $object_id ? $object_id : get_the_ID(); 
  4. $cmb = cmb2_get_metabox( $meta_box, $object_id ); 
  5.  
  6. ob_start(); 
  7. // Get cmb form 
  8. cmb2_print_metabox_form( $cmb, $object_id, $args ); 
  9. $form = ob_get_contents(); 
  10. ob_end_clean(); 
  11.  
  12. return apply_filters( 'cmb2_get_metabox_form', $form, $object_id, $cmb ); 
/vendor/wordimpress/maps-builder-core/includes/libraries/metabox/includes/helper-functions.php  
  1. function cmb2_get_metabox_form( $meta_box, $object_id = 0, $args = array() ) { 
  2.  
  3. $object_id = $object_id ? $object_id : get_the_ID(); 
  4. $cmb = cmb2_get_metabox( $meta_box, $object_id ); 
  5.  
  6. ob_start(); 
  7. // Get cmb form 
  8. cmb2_print_metabox_form( $cmb, $object_id, $args ); 
  9. $form = ob_get_contents(); 
  10. ob_end_clean(); 
  11.  
  12. return apply_filters( 'cmb2_get_metabox_form', $form, $object_id, $cmb );