<object_type>

Fires before fields have been processed/saved.

Description

do_action( '<object_type>', (array) $instance, (int) $this_object_id ); 

The dynamic portion(s) of the hook name refer is the meta_box id.

The dynamic portion(s) of the hook name refer to the metabox/form's object type Could also be comment,, user. or options-page.

Parameters (2)

0. $instance (array)
This CMB2 object
1. $this_object_id (int)
The ID of the current object

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( '{$object_type}', $instance, $this_object_id ); 
The following example is for adding a hook callback.
  1. // define the <object_type> callback 
  2. function action_object_type( $instance, $this_object_id ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( "{$object_type}", 'action_object_type', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( "{$object_type}", 'action_object_type', 10, 2 ); 

Defined (1)

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

/includes/CMB2.php  
  1. do_action( "cmb2_{$this->object_type()}_process_fields_{$this->cmb_id}", $this, $this->object_id() );