caldera_forms_api_show_field

Prevent a field from being shown in API responses.

Description

apply_filters( 'caldera_forms_api_show_field', (bool) $true, (string) $field_id, (array) $field, (array) $this_form, (WP_REST_Request) $this_request ); 

Parameters (5)

0. $true (bool) => true
If false, field is not returned.
1. $field_id (string)
The field id.
2. $field (array)
Field config
3. $this_form (array)
The this form.
4. $this_request (WP_REST_Request)
Current REST API request

Usage

To run the hook, copy the example below.
  1. $true = apply_filters( 'caldera_forms_api_show_field', $true, $field_id, $field, $this_form, $this_request ); 
  2.  
  3. if ( !empty( $true ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the caldera_forms_api_show_field callback 
  2. function filter_caldera_forms_api_show_field( $true, $field_id, $field, $this_form, $this_request ) { 
  3. // make filter magic happen here... 
  4. return $true
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'caldera_forms_api_show_field', 'filter_caldera_forms_api_show_field', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'caldera_forms_api_show_field', 'filter_caldera_forms_api_show_field', 10, 5 ); 

Defined (1)

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

/classes/api/form.php  
  1. if( false == apply_filters( 'caldera_forms_api_show_field', true, $field_id, $field, $this->form, $this->request ) ) {