GravityView_Metabox_Tab
The class for a metabox tab in the GravityView View Settings metabox
See Also
Since: 1.8
Source: includes/admin/metaboxes/class-gravityview-metabox-tab.php:10
Details
- Kind:
class - Namespace:
(global)
Properties
| Property | Type | Description |
|---|---|---|
$id | String for use in the 'id' attribute of tags. | |
$title | Title of the meta box. | |
$callback | Function that fills the box with the desired content. The function should echo its output. | |
$screen | Optional. The screen on which to show the box (like a post type, 'link', or 'comment'). Default is the current screen. | |
$context | Optional. The context within the screen where the boxes should display. | |
$priority | Optional. The priority within the context where the boxes should show ('high', 'low'). Default 'default'. | |
$callback_args | Optional. Data that should be set as the $args property of the box array (which is the second parameter passed to your callback). Default null. | |
$render_template_file | string | Define a file stored in the partials directory to render the output |
$icon_class_name | string | CSS class for the tab icon |
$extra_nav_class | string | CSS class to append to the navigation tab. |
Methods
| Method | Description |
|---|---|
__construct() | Create a new metabox tab |
parse_icon_class_name() | If the name of the CSS class has dashicon in it, add the dashicons prefix |
render() | Render the tab |
Method Reference
__construct()
function __construct( $id, $title='', $file='', $icon_class_name='', $callback='', $callback_args=[] )
Create a new metabox tab
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$id | string Metabox HTML ID, without gravityview_ prefix | ||
$title | string | '' | Name of the metabox. Shown in the tab. |
$file | string | '' | The file name of a file stored in the /gravityview/includes/admin/metaboxes/views/ directory to render the metabox output, or the full path to a file. If defined, callback is not used. |
$icon_class_name | string | '' | Icon class used in vertical tabs. Supports non-dashicon. If dashicons, no need for dashicons prefix |
$callback | string | '' | Function to render the metabox, if $file is not defined. |
$callback_args | array | [] | Arguments passed to the callback |
Returns
void
Since: 1.8
Source: includes/admin/metaboxes/class-gravityview-metabox-tab.php:115
parse_icon_class_name()
function parse_icon_class_name( $icon_class_name='' )
If the name of the CSS class has dashicon in it, add the dashicons prefix
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$icon_class_name | string | '' | Passed class name |
Returns
string— sanitized CSS class
Since: 1.8
Source: includes/admin/metaboxes/class-gravityview-metabox-tab.php:134
render()
function render( $post )
Render the tab
If the $file parameter was passed when registering a new GravityView_Metabox_Tab, then the file is included.
The include checks for a full file path first, and if a file exists, use that file. If the file doesn't exist, then the code looks inside the [gravityview]/includes/admin/metaboxes/views/ dir.
Finally, if there's no file specified, but there's a $callback parameter specified, use the callback.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$post | WP_Post | Currently edited post object |
Since: 1.8
Source: includes/admin/metaboxes/class-gravityview-metabox-tab.php:158