CMB2_Boxes

A CMB2 object instance registry for storing every CMB2 instance.

Defined (2)

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

/includes/libraries/metabox/includes/CMB2_Boxes.php  
  1. class CMB2_Boxes { 
  2.  
  3. /** 
  4. * Array of all metabox objects 
  5. * @var array 
  6. * @since 2.0.0 
  7. */ 
  8. protected static $cmb2_instances = array(); 
  9.  
  10. /** 
  11. * Add a CMB2 instance object to the registry 
  12. * @since 1.X.X 
  13. * @param CMB2 $cmb_instance CMB2 instance 
  14. */ 
  15. public static function add( CMB2 $cmb_instance ) { 
  16. self::$cmb2_instances[ $cmb_instance->cmb_id ] = $cmb_instance; 
  17.  
  18. /** 
  19. * Remove a CMB2 instance object to the registry 
  20. * @since 1.X.X 
  21. * @param string $cmb_id A CMB2 instance id 
  22. */ 
  23. public static function remove( $cmb_id ) { 
  24. if ( array_key_exists( $cmb_id, self::$cmb2_instances ) ) { 
  25. unset( self::$cmb2_instances[ $cmb_id ] ); 
  26.  
  27. /** 
  28. * Retrieve a CMB2 instance by cmb id 
  29. * @since 1.X.X 
  30. * @param string $cmb_id A CMB2 instance id 
  31. * @return mixed False or CMB2 object instance 
  32. */ 
  33. public static function get( $cmb_id ) { 
  34. if ( empty( self::$cmb2_instances ) || empty( self::$cmb2_instances[ $cmb_id ] ) ) { 
  35. return false; 
  36.  
  37. return self::$cmb2_instances[ $cmb_id ]; 
  38.  
  39. /** 
  40. * Retrieve all CMB2 instances registered 
  41. * @since 1.X.X 
  42. * @return array Array of all registered metaboxes 
  43. */ 
  44. public static function get_all() { 
  45. return self::$cmb2_instances; 
  46.  
/vendor/wordimpress/maps-builder-core/includes/libraries/metabox/includes/CMB2_Boxes.php  
  1. class CMB2_Boxes { 
  2.  
  3. /** 
  4. * Array of all metabox objects. 
  5. * @since 2.0.0 
  6. * @var array 
  7. */ 
  8. protected static $cmb2_instances = array(); 
  9.  
  10. /** 
  11. * Add a CMB2 instance object to the registry. 
  12. * @since 1.X.X 
  13. * @param CMB2 $cmb_instance CMB2 instance. 
  14. */ 
  15. public static function add( CMB2 $cmb_instance ) { 
  16. self::$cmb2_instances[ $cmb_instance->cmb_id ] = $cmb_instance; 
  17.  
  18. /** 
  19. * Remove a CMB2 instance object to the registry. 
  20. * @since 1.X.X 
  21. * @param string $cmb_id A CMB2 instance id. 
  22. */ 
  23. public static function remove( $cmb_id ) { 
  24. if ( array_key_exists( $cmb_id, self::$cmb2_instances ) ) { 
  25. unset( self::$cmb2_instances[ $cmb_id ] ); 
  26.  
  27. /** 
  28. * Retrieve a CMB2 instance by cmb id. 
  29. * @since 1.X.X 
  30. * @param string $cmb_id A CMB2 instance id. 
  31. * @return CMB2|bool False or CMB2 object instance. 
  32. */ 
  33. public static function get( $cmb_id ) { 
  34. if ( empty( self::$cmb2_instances ) || empty( self::$cmb2_instances[ $cmb_id ] ) ) { 
  35. return false; 
  36.  
  37. return self::$cmb2_instances[ $cmb_id ]; 
  38.  
  39. /** 
  40. * Retrieve all CMB2 instances registered. 
  41. * @since 1.X.X 
  42. * @return CMB2[] Array of all registered metaboxes. 
  43. */ 
  44. public static function get_all() { 
  45. return self::$cmb2_instances; 
  46.