cmb2_group_wrap_attributes

Allow for adding additional HTML attributes to a group wrapper.

Description

apply_filters( 'cmb2_group_wrap_attributes', (string) $group_wrap_attributes, (CMB2_Field) $field_group ); 

The attributes will be an array of key => value pairs for each attribute.

Parameters (2)

0. $group_wrap_attributes (string)
The group wrap attributes.
1. $field_group (CMB2_Field)
The group CMB2_Field object.

Usage

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

Defined (1)

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

/includes/CMB2.php  
  1. $group_wrap_attributes = apply_filters( 'cmb2_group_wrap_attributes', $group_wrap_attributes, $field_group );