GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-metabox-tabs.php
Go to the documentation of this file.
1 <?php
2 
3 /**
4  * Stores each GravityView_Metabox_Tab instance
5  * @since 1.8
6  * @see https://gist.github.com/zackkatz/6cc381bcf54849f2ed41 For example of adding a metabox
7  * @see https://github.com/WebDevStudios/CMB2/blob/master/includes/CMB2_Boxes.php Thanks for the inspiration
8  */
10 
11  /**
12  * Array of all GravityView_Metabox_Tab objects
13  * @var array
14  * @since 1.8
15  */
16  protected static $meta_boxes = array();
17 
18  /**
19  * Add a tab
20  *
21  * @since 1.8
22  *
23  * @param GravityView_Metabox_Tab $meta_box
24  *
25  * @return void
26  */
27  public static function add( GravityView_Metabox_Tab $meta_box ) {
28  self::$meta_boxes[ $meta_box->id ] = $meta_box;
29  }
30 
31  /**
32  * Remove a tab by tab ID
33  *
34  * @since 1.8
35  *
36  * @param string $meta_box_id
37  *
38  * @return void
39  */
40  public static function remove( $meta_box_id ) {
41  if ( array_key_exists( $meta_box_id, self::$meta_boxes ) ) {
42  unset( self::$meta_boxes[ $meta_box_id ] );
43  }
44  }
45 
46  /**
47  * Get a tab by ID
48  *
49  * @since 1.8
50  *
51  * @param string $id
52  *
53  * @return bool|GravityView_Metabox_Tab False if none exist at the key $id; GravityView_Metabox_Tab if exists.
54  */
55  public static function get( $id ) {
56  if ( empty( self::$meta_boxes ) || empty( self::$meta_boxes[ $id ] ) ) {
57  return false;
58  }
59 
60  return self::$meta_boxes[ $id ];
61  }
62 
63  /**
64  * Get array of all registered metaboxes
65  *
66  * @return array|GravityView_Metabox_Tab[] Empty array if no tabs, otherwise array of `GravityView_Metabox_Tab`s
67  */
68  public static function get_all() {
69  return self::$meta_boxes;
70  }
71 
72 }
static get_all()
Get array of all registered metaboxes.
Stores each GravityView_Metabox_Tab instance.
The class for a metabox tab in the GravityView View Settings metabox.
static add(GravityView_Metabox_Tab $meta_box)
Add a tab.