cmb_<element>_attributes

Handles parsing and filtering attributes while preserving any passed in via field config.

Description

(array) apply_filters( 'cmb_<element>_attributes', (array) $this_field_maybe_set_attributes_args, (string) $this_field, (array) $instance ); 

Returns (array)

Parsed and filtered arguments

Parameters (3)

0. $this_field_maybe_set_attributes_args (array)
The this field maybe set attributes args.
1. $this_field (string)
Element for filter
2. $instance (array)
Default arguments

Usage

To run the hook, copy the example below.
  1. $this_field_maybe_set_attributes_args = apply_filters( 'cmb_{$element}_attributes', $this_field_maybe_set_attributes_args, $this_field, $instance ); 
  2.  
  3. if ( !empty( $this_field_maybe_set_attributes_args ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the cmb_<element>_attributes callback 
  2. function filter_cmb_element_attributes( $this_field_maybe_set_attributes_args, $this_field, $instance ) { 
  3. // make filter magic happen here... 
  4. return $this_field_maybe_set_attributes_args
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "cmb_{$element}_attributes", 'filter_cmb_element_attributes', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "cmb_{$element}_attributes", 'filter_cmb_element_attributes', 10, 3 ); 

Defined (1)

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

/admin/includes/CMBF/helpers/cmb_Meta_Box_types.php  
  1. return wp_parse_args( apply_filters( "cmb_{$element}_attributes", $this->field->maybe_set_attributes( $args ), $this->field, $this ), $defaults );