Adds a meta box to the edit page.
Description
See also
Parameters
- $id
-
(string) (Required) Meta box identifier.
- $args
-
(array) (Optional) Meta box arguments.
- 'title'
(string) Meta box title. - 'description'
(string) Meta box description. - 'context'
(string) Meta box content. Either 'normal', 'advanced' or 'side'. Default 'advanced'. - 'priority'
(string) Meta box priority. Either 'high', 'core', 'default' or 'low'. Default 'default'.
- 'title'
Source
File: src/db-objects/forms/form-edit-page-handler.php
public function add_meta_box( $id, $args ) { $prefix = $this->form_manager->get_prefix(); if ( 0 !== strpos( $id, $prefix ) ) { $id = $prefix . $id; } $this->meta_boxes[ $id ] = wp_parse_args( $args, array( 'title' => '', 'description' => '', 'content' => 'advanced', 'priority' => 'default', ) ); $services = array( 'ajax' => $this->form_manager->ajax(), 'assets' => $this->form_manager->assets(), 'error_handler' => $this->form_manager->error_handler(), ); $this->meta_boxes[ $id ]['field_manager'] = new Field_Manager( $prefix, $services, array( 'get_value_callback' => array( $this, 'get_meta_values' ), 'get_value_callback_args' => array( $id ), 'update_value_callback' => array( $this, 'update_meta_values' ), 'update_value_callback_args' => array( $id, '{value}' ), 'name_prefix' => $id, 'render_mode' => 'form-table', ) ); }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |