/**
 * Filters the data to remove those values which are not suppose to be enabled to edit according to the declared conditionals.
 */
function cmb2_conditional_filter_data_to_save(CMB2 $cmb2, $object_id)
{
    foreach ($cmb2->prop('fields') as $field_args) {
        if (!(array_key_exists('attributes', $field_args) && array_key_exists('data-conditional-id', $field_args['attributes']))) {
            continue;
        }
        $field_id = $field_args['id'];
        $conditional_id = $field_args['attributes']['data-conditional-id'];
        if (array_key_exists('data-conditional-value', $field_args['attributes'])) {
            $conditional_value = $field_args['attributes']['data-conditional-value'];
            $conditional_value = ($decoded_conditional_value = @json_decode($conditional_value)) ? $decoded_conditional_value : $conditional_value;
            if (is_array($conditional_value) && !in_array($cmb2->data_to_save[$conditional_id], $conditional_value)) {
                unset($cmb2->data_to_save[$field_id]);
                continue;
            }
            if (!is_array($conditional_value) && $cmb2->data_to_save[$conditional_id] != $conditional_value) {
                unset($cmb2->data_to_save[$field_id]);
                continue;
            }
        }
        if (!$cmb2->data_to_save[$conditional_id]) {
            unset($cmb2->data_to_save[$field_id]);
            continue;
        }
    }
}
 /**
  * Handles saving of the $_POST data
  * @since  0.1.3
  * @param  int $term_id Term's ID
  */
 public function do_save($term_id)
 {
     if (!class_exists('CMB2')) {
         return;
     }
     $object_id = $this->id($term_id);
     if (isset($_POST[$this->cmb->nonce()]) && wp_verify_nonce($_POST[$this->cmb->nonce()], $this->cmb->nonce())) {
         $this->do_override_filters($term_id);
         $this->cmb->save_fields($object_id, 'options-page', $_POST);
     }
 }
 /**
  * @param \CMB2 $meta_box The meta box to add fields to.
  * @param array $params   The params to add fields with.
  */
 private function add_blocks($meta_box, $params)
 {
     $meta_box->add_field(array('name' => $params['block'] . ' ' . __('block title', 'yoastcom'), 'id' => 'block_' . $params['name'] . '_title', 'type' => 'text'));
     $meta_box->add_field(array('name' => $params['block'] . ' ' . __('block description', 'yoastcom'), 'id' => 'block_' . $params['name'] . '_description', 'type' => 'textarea'));
     $meta_box->add_field(array('name' => $params['block'] . ' ' . __('block link text', 'yoastcom'), 'id' => 'block_' . $params['name'] . '_link_text', 'type' => 'text'));
     $meta_box->add_field(array('name' => $params['block'] . ' ' . __('block link', 'yoastcom'), 'id' => 'block_' . $params['name'] . '_link', 'type' => 'text_url'));
     $meta_box->add_field(array('name' => $params['block'] . ' ' . __('block icon', 'yoastcom'), 'id' => 'block_' . $params['name'] . '_icon', 'type' => 'select', 'options' => array('academy' => 'Academy', 'blog' => 'Blog', 'book' => 'Book', 'calendar' => 'Calendar', 'drupal' => 'Drupal', 'pencil' => 'Pencil', 'video' => 'Video', 'wordpress' => 'WordPress')));
 }
 /**
  * Defines the Google Places CPT metabox and field configuration.
  *
  * @since  1.0.0
  * @return array
  */
 public function cpt2_metaboxes_fields()
 {
     $prefix = 'gmb_';
     $default_options = $this->get_default_map_options();
     // Google map preview.
     $preview_box = cmb2_get_metabox(array('id' => 'google_maps_preview_metabox', 'title' => __('Google Map Preview', 'google-maps-builder'), 'object_types' => array('google_maps'), 'context' => 'normal', 'priority' => 'high', 'show_names' => false));
     $preview_box->add_field(array('name' => __('Map Preview', 'google-maps-builder'), 'id' => $prefix . 'preview', 'type' => 'google_maps_preview', 'default' => ''));
     // Google maps markers.
     $this->marker_box = cmb2_get_metabox(array('id' => 'google_maps_markers', 'title' => __('Map Markers', 'google-maps-builder'), 'object_types' => array('google_maps'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
     $this->marker_box->add_field(array('name' => __('Create Marker', 'google-maps-builder'), 'id' => $prefix . 'geocoder', 'type' => 'google_geocoder'));
     $this->marker_box_group_field_id = $this->marker_box->add_field(array('name' => __('Existing Markers', 'google-maps-builder'), 'id' => $prefix . 'markers_group', 'type' => 'group', 'description' => __('Map marker data is contained within the repeatable fields below. You may add or update marker data here or directly on the map.', 'google-maps-builder') . '<a href="#" class="button button-small toggle-repeater-groups">' . __('Toggle Marker Groups', 'google-maps-builder') . '</a>', 'options' => array('group_title' => __('Marker: {#}', 'cmb'), 'add_button' => __('Add Another Marker', 'google-maps-builder'), 'remove_button' => __('Remove Marker', 'google-maps-builder'), 'sortable' => true)));
     $this->marker_box->add_group_field($this->marker_box_group_field_id, array('name' => __('Marker Title', 'google-maps-builder'), 'id' => 'title', 'type' => 'text'));
     $this->marker_box->add_group_field($this->marker_box_group_field_id, array('name' => __('Marker Description', 'google-maps-builder'), 'description' => __('Write a short description for this marker', 'google-maps-builder'), 'id' => 'description', 'type' => 'textarea_small', 'sanitization_cb' => false));
     $this->marker_box->add_group_field($this->marker_box_group_field_id, array('name' => __('Marker Reference', 'google-maps-builder'), 'id' => 'reference', 'type' => 'text'));
     $this->marker_box->add_group_field($this->marker_box_group_field_id, array('name' => __('Marker Place ID', 'google-maps-builder'), 'id' => 'place_id', 'type' => 'text'));
     $this->marker_box->add_group_field($this->marker_box_group_field_id, array('name' => __('Hide Place Details', 'google-maps-builder'), 'id' => 'hide_details', 'type' => 'checkbox'));
     $this->marker_box->add_group_field($this->marker_box_group_field_id, array('name' => __('Marker Latitude', 'google-maps-builder'), 'id' => 'lat', 'type' => 'text'));
     $this->marker_box->add_group_field($this->marker_box_group_field_id, array('name' => __('Marker Longitude', 'google-maps-builder'), 'id' => 'lng', 'type' => 'text'));
     $this->marker_box->add_group_field($this->marker_box_group_field_id, array('name' => __('Custom Marker Image', 'google-maps-builder'), 'id' => 'marker_img', 'row_classes' => 'gmb-hidden', 'type' => 'file', 'options' => array('url' => false, 'add_upload_file_text' => __('Add Marker Image', 'google-maps-builder'))));
     $this->marker_box->add_group_field($this->marker_box_group_field_id, array('name' => __('Included Marker Icon', 'google-maps-builder'), 'row_classes' => 'gmb-hidden', 'id' => 'marker_included_img', 'type' => 'text'));
     $this->marker_box->add_group_field($this->marker_box_group_field_id, array('name' => __('Marker Data', 'google-maps-builder'), 'row_classes' => 'gmb-hidden', 'id' => 'marker', 'type' => 'textarea_code'));
     $this->marker_box->add_group_field($this->marker_box_group_field_id, array('name' => __('Marker Label Data', 'google-maps-builder'), 'row_classes' => 'gmb-hidden', 'id' => 'label', 'type' => 'textarea_code'));
     // Search options.
     $this->search_options = cmb2_get_metabox(array('id' => 'google_maps_search_options', 'title' => __('Google Places', 'google-maps-builder'), 'object_types' => array('google_maps'), 'context' => 'normal', 'priority' => 'core', 'show_names' => true));
     $this->search_options->add_field(array('name' => __('Show Places?', 'google-maps-builder'), 'desc' => __('Display establishments, prominent points of interest, geographic locations, and more.', 'google-maps-builder'), 'id' => $prefix . 'show_places', 'type' => 'radio_inline', 'options' => array('yes' => __('Yes', 'cmb'), 'no' => __('No', 'cmb'))));
     $this->search_options->add_field(array('name' => __('Search Radius', 'google-maps-builder'), 'desc' => __('Defines the distance (in meters) within which to return Place markers. The maximum allowed radius is 50,000 meters.', 'google-maps-builder'), 'default' => '3000', 'id' => $prefix . 'search_radius', 'type' => 'text_small'));
     $this->search_options->add_field(array('name' => __('Place Types', 'google-maps-builder'), 'desc' => __('Select which type of places you would like to display on this map.', 'google-maps-builder'), 'id' => $prefix . 'places_search_multicheckbox', 'type' => 'multicheck', 'options' => apply_filters('gmb_place_types', array('accounting' => __('Accounting', 'google-maps-builder'), 'airport' => __('Airport', 'google-maps-builder'), 'amusement_park' => __('Amusement Park', 'google-maps-builder'), 'aquarium' => __('Aquarium', 'google-maps-builder'), 'art_gallery' => __('Art Gallery', 'google-maps-builder'), 'atm' => __('ATM', 'google-maps-builder'), 'bakery' => __('Bakery', 'google-maps-builder'), 'bank' => __('Bank', 'google-maps-builder'), 'bar' => __('Bar', 'google-maps-builder'), 'beauty_salon' => __('Beauty Salon', 'google-maps-builder'), 'bicycle_store' => __('Bicycle Store', 'google-maps-builder'), 'book_store' => __('Book Store', 'google-maps-builder'), 'bowling_alley' => __('Bowling Alley', 'google-maps-builder'), 'bus_station' => __('Bus Station', 'google-maps-builder'), 'cafe' => __('Cafe', 'google-maps-builder'), 'campground' => __('Campground', 'google-maps-builder'), 'car_dealer' => __('Car Dealer', 'google-maps-builder'), 'car_rental' => __('Car Rental', 'google-maps-builder'), 'car_repair' => __('Car Repair', 'google-maps-builder'), 'car_wash' => __('Car Wash', 'google-maps-builder'), 'casino' => __('Casino', 'google-maps-builder'), 'cemetery' => __('Cemetery', 'google-maps-builder'), 'church' => __('Church', 'google-maps-builder'), 'city_hall' => __('City Hall', 'google-maps-builder'), 'clothing_store' => __('Clothing Store', 'google-maps-builder'), 'convenience_store' => __('Convenience Store', 'google-maps-builder'), 'courthouse' => __('Courthouse', 'google-maps-builder'), 'dentist' => __('Dentist', 'google-maps-builder'), 'department_store' => __('Department Store', 'google-maps-builder'), 'doctor' => __('Doctor', 'google-maps-builder'), 'electrician' => __('Electrician', 'google-maps-builder'), 'electronics_store' => __('Electronics Store', 'google-maps-builder'), 'embassy' => __('Embassy', 'google-maps-builder'), 'establishment' => __('Establishment', 'google-maps-builder'), 'finance' => __('Finance', 'google-maps-builder'), 'fire_station' => __('Fire Station', 'google-maps-builder'), 'florist' => __('Florist', 'google-maps-builder'), 'food' => __('Food', 'google-maps-builder'), 'funeral_home' => __('Funeral Home', 'google-maps-builder'), 'furniture_store' => __('Furniture_store', 'google-maps-builder'), 'gas_station' => __('Gas Station', 'google-maps-builder'), 'general_contractor' => __('General Contractor', 'google-maps-builder'), 'grocery_or_supermarket' => __('Grocery or Supermarket', 'google-maps-builder'), 'gym' => __('Gym', 'google-maps-builder'), 'hair_care' => __('Hair Care', 'google-maps-builder'), 'hardware_store' => __('Hardware Store', 'google-maps-builder'), 'health' => __('Health', 'google-maps-builder'), 'hindu_temple' => __('Hindu Temple', 'google-maps-builder'), 'home_goods_store' => __('Home Goods Store', 'google-maps-builder'), 'hospital' => __('Hospital', 'google-maps-builder'), 'insurance_agency' => __('Insurance Agency', 'google-maps-builder'), 'jewelry_store' => __('Jewelry Store', 'google-maps-builder'), 'laundry' => __('Laundry', 'google-maps-builder'), 'lawyer' => __('Lawyer', 'google-maps-builder'), 'library' => __('Library', 'google-maps-builder'), 'liquor_store' => __('Liquor Store', 'google-maps-builder'), 'local_government_office' => __('Local Government Office', 'google-maps-builder'), 'locksmith' => __('Locksmith', 'google-maps-builder'), 'lodging' => __('Lodging', 'google-maps-builder'), 'meal_delivery' => __('Meal Delivery', 'google-maps-builder'), 'meal_takeaway' => __('Meal Takeaway', 'google-maps-builder'), 'mosque' => __('Mosque', 'google-maps-builder'), 'movie_rental' => __('Movie Rental', 'google-maps-builder'), 'movie_theater' => __('Movie Theater', 'google-maps-builder'), 'moving_company' => __('Moving Company', 'google-maps-builder'), 'museum' => __('Museum', 'google-maps-builder'), 'night_club' => __('Night Club', 'google-maps-builder'), 'painter' => __('Painter', 'google-maps-builder'), 'park' => __('Park', 'google-maps-builder'), 'parking' => __('Parking', 'google-maps-builder'), 'pet_store' => __('Pet Store', 'google-maps-builder'), 'pharmacy' => __('Pharmacy', 'google-maps-builder'), 'physiotherapist' => __('Physiotherapist', 'google-maps-builder'), 'place_of_worship' => __('Place of Worship', 'google-maps-builder'), 'plumber' => __('Plumber', 'google-maps-builder'), 'police' => __('Police', 'google-maps-builder'), 'post_office' => __('Post Office', 'google-maps-builder'), 'real_estate_agency' => __('Real Estate Agency', 'google-maps-builder'), 'restaurant' => __('Restaurant', 'google-maps-builder'), 'roofing_contractor' => __('Roofing Contractor', 'google-maps-builder'), 'rv_park' => __('RV Park', 'google-maps-builder'), 'school' => __('School', 'google-maps-builder'), 'shoe_store' => __('Shoe Store', 'google-maps-builder'), 'shopping_mall' => __('Shopping Mall', 'google-maps-builder'), 'spa' => __('Spa', 'google-maps-builder'), 'stadium' => __('Stadium', 'google-maps-builder'), 'storage' => __('Storage', 'google-maps-builder'), 'store' => __('Store', 'google-maps-builder'), 'subway_station' => __('Subway Station', 'google-maps-builder'), 'synagogue' => __('Synagogue', 'google-maps-builder'), 'taxi_stand' => __('Taxi Stand', 'google-maps-builder'), 'train_station' => __('Train Station', 'google-maps-builder'), 'travel_agency' => __('Travel Agency', 'google-maps-builder'), 'university' => __('University', 'google-maps-builder'), 'veterinary_care' => __('Veterinary Care', 'google-maps-builder'), 'zoo' => __('Zoo', 'google-maps-builder')))));
     /**
      * Display Options
      */
     $this->display_options = cmb2_get_metabox(array('id' => 'google_maps_options', 'title' => __('Display Options', 'google-maps-builder'), 'object_types' => array('google_maps'), 'context' => 'side', 'priority' => 'default', 'show_names' => true));
     $this->display_options->add_field(array('name' => __('Map Size', 'google-maps-builder'), 'id' => $prefix . 'width_height', 'type' => 'width_height', 'width_std' => $default_options['width'], 'width_unit_std' => $default_options['width_unit'], 'height_std' => $default_options['height'], 'desc' => ''));
     $this->display_options->add_field(array('name' => __('Map Location', 'google-maps-builder'), 'id' => $prefix . 'lat_lng', 'type' => 'lat_lng', 'lat_std' => '', 'lng_std' => '', 'desc' => ''));
     $this->display_options->add_field(array('name' => __('Map Type', 'google-maps-builder'), 'id' => $prefix . 'type', 'type' => 'select', 'default' => 'default', 'options' => array('RoadMap' => __('Road Map', 'google-maps-builder'), 'Satellite' => __('Satellite', 'google-maps-builder'), 'Hybrid' => __('Hybrid', 'google-maps-builder'), 'Terrain' => __('Terrain', 'google-maps-builder'))));
     $this->display_options->add_field(array('name' => 'Zoom', 'desc' => __('Adjust the map zoom (0-21)', 'google-maps-builder'), 'id' => $prefix . 'zoom', 'type' => 'select', 'default' => '15', 'options' => apply_filters('gmb_map_zoom_levels', array('21' => '21', '20' => '20', '19' => '19', '18' => '18', '17' => '17', '16' => '16', '15' => '15', '14' => '14', '13' => '13', '12' => '12', '11' => '11', '10' => '10', '9' => '9', '8' => '8', '7' => '7', '6' => '6', '5' => '5', '4' => '4', '3' => '3', '2' => '2', '1' => '1', '0' => '0'))));
     $this->display_options->add_field(array('name' => 'Map Layers', 'desc' => __('Layers provide additional information overlayed on the map.', 'google-maps-builder'), 'id' => $prefix . 'layers', 'type' => 'multicheck', 'select_all_button' => false, 'options' => apply_filters('gmb_map_zoom_levels', array('traffic' => __('Traffic', 'google-maps-builder'), 'transit' => __('Transit', 'google-maps-builder'), 'bicycle' => __('Bicycle', 'google-maps-builder')))));
     $this->display_options->add_field(array('name' => __('Map Theme', 'google-maps-builder'), 'desc' => sprintf(__('Set optional preconfigured <a href="%1s" class="snazzy-link new-window"  target="_blank">Snazzy Maps</a> styles by selecting from the dropdown above.', 'google-maps-builder'), esc_url('http://snazzymaps.com')), 'id' => $prefix . 'theme', 'type' => 'select', 'default' => 'none', 'options' => apply_filters('gmb_snazzy_maps', array('none' => __('None', 'google-maps-builder'), '68' => __('Aqua', 'google-maps-builder'), '73' => __('A Dark World', 'google-maps-builder'), '28' => __('Bluish', 'google-maps-builder'), '80' => __('Cool Grey', 'google-maps-builder'), '77' => __('Clean Cut', 'google-maps-builder'), '36' => __('Flat Green', 'google-maps-builder'), '44' => __('MapBox', 'google-maps-builder'), '83' => __('Muted Blue', 'google-maps-builder'), '22' => __('Old Timey', 'google-maps-builder'), '1' => __('Pale Dawn', 'google-maps-builder'), '19' => __('Paper', 'google-maps-builder'), '37' => __('Lunar Landscape', 'google-maps-builder'), '75' => __('Shade of Green', 'google-maps-builder'), '27' => __('Shift Worker', 'google-maps-builder'), '15' => __('Subtle Grayscale', 'google-maps-builder'), '50' => __('The Endless Atlas', 'google-maps-builder')))));
     $this->display_options->add_field(array('name' => __('Custom Map Theme JSON', 'google-maps-builder'), 'desc' => __('Paste the Snazzy Map JSON code into the field above to set the theme.', 'google-maps-builder'), 'id' => $prefix . 'theme_json', 'type' => 'textarea_code'));
     // Control options.
     $this->control_options = cmb2_get_metabox(array('id' => 'google_maps_control_options', 'title' => __('Map Controls', 'google-maps-builder'), 'object_types' => array('google_maps'), 'context' => 'side', 'priority' => 'default', 'show_names' => true));
     $this->control_options->add_field(array('name' => __('Zoom Control', 'google-maps-builder'), 'id' => $prefix . 'zoom_control', 'type' => 'select', 'default' => 'default', 'options' => array('none' => __('None', 'google-maps-builder'), 'small' => __('Small', 'google-maps-builder'), 'large' => __('Large', 'google-maps-builder'), 'default' => __('Default', 'google-maps-builder'))));
     $this->control_options->add_field(array('name' => __('Street View', 'google-maps-builder'), 'id' => $prefix . 'street_view', 'type' => 'select', 'default' => 'true', 'options' => array('none' => __('None', 'google-maps-builder'), 'true' => __('Standard', 'google-maps-builder'))));
     $this->control_options->add_field(array('name' => __('Pan Control', 'google-maps-builder'), 'id' => $prefix . 'pan', 'type' => 'select', 'default' => 'true', 'options' => array('none' => __('None', 'google-maps-builder'), 'true' => __('Standard', 'google-maps-builder'))));
     $this->control_options->add_field(array('name' => __('Map Type Control', 'google-maps-builder'), 'id' => $prefix . 'map_type_control', 'type' => 'select', 'default' => 'horizontal_bar', 'options' => array('none' => __('None', 'google-maps-builder'), 'dropdown_menu' => __('Dropdown Menu', 'google-maps-builder'), 'horizontal_bar' => __('Horizontal Bar', 'google-maps-builder'))));
     $this->control_options->add_field(array('name' => __('Draggable Map', 'google-maps-builder'), 'id' => $prefix . 'draggable', 'type' => 'select', 'default' => 'true', 'options' => array('none' => __('None', 'google-maps-builder'), 'true' => __('Standard', 'google-maps-builder'))));
     $this->control_options->add_field(array('name' => __('Double Click to Zoom', 'google-maps-builder'), 'id' => $prefix . 'double_click', 'type' => 'select', 'default' => 'true', 'options' => array('none' => __('None', 'google-maps-builder'), 'true' => __('Standard', 'google-maps-builder'))));
     $this->control_options->add_field(array('name' => __('Mouse Wheel to Zoom', 'google-maps-builder'), 'id' => $prefix . 'wheel_zoom', 'type' => 'select', 'default' => 'true', 'options' => array('none' => __('Disabled', 'google-maps-builder'), 'true' => __('Standard', 'google-maps-builder'))));
 }
Example #5
0
 public function test_disable_save_fields()
 {
     $this->assertTrue($this->cmb->prop('save_fields'));
     $args = $this->metabox_array;
     $args['save_fields'] = false;
     $cmb = new CMB2($args);
     $this->assertFalse($cmb->prop('save_fields'));
 }
Example #6
0
<?php

/**
 * Helper function to provide directory path to CMB
 * @since  2.0.0
 * @param  string  $path Path to append
 * @return string        Directory with optional path appended
 */
function cmb2_dir($path = '')
{
    return trailingslashit(dirname(__FILE__)) . $path;
}
require_once cmb2_dir('includes/helper-functions.php');
$meta_boxes_config = apply_filters('cmb2_meta_boxes', array());
foreach ((array) $meta_boxes_config as $meta_box) {
    $cmb = new CMB2($meta_box);
    if ($cmb->prop('hookup')) {
        $hookup = new CMB2_hookup($cmb);
    }
}
/**
 * Create meta boxes
 */
class CMB2
{
    /**
     * Current field's ID
     * @var   string
     * @since 2.0.0
     */
    protected $cmb_id = '';
 /**
  * Determine whether the CMB2 object should be saved. All tests must be true, hence return false for
  * any failure.
  *
  * @param string $id @since 1.1.0
  * @param \CMB2 $cmb
  *
  * @return bool
  *
  * @since 1.1.0 static unclung
  * @since 1.0.3 made static method
  * @since 1.0.1
  */
 private function should_save($cmb, $id)
 {
     // was this flagged to save fields?
     if (!$cmb->prop('save_fields')) {
         return FALSE;
     }
     // are these values set?
     if (!isset($_POST['submit-cmb'], $_POST['object_id'], $_POST[$cmb->nonce()])) {
         return FALSE;
     }
     // does the nonce match?
     if (!wp_verify_nonce($_POST[$cmb->nonce()], $cmb->nonce())) {
         return FALSE;
     }
     // does the object_id equal the settings key?
     if (!$_POST['object_id'] == self::$props[$id]['key']) {
         return FALSE;
     }
     return TRUE;
 }
 /**
  * Filter the data received from the form in order to remove those values
  * which are not suppose to be enabled to edit according to the declared conditionals.
  *
  * @param \CMB2 $cmb2      An instance of the CMB2 class.
  * @param int   $object_id The id of the object being saved, could post_id, comment_id, user_id.
  *
  * The potentially adjusted array is returned via reference $cmb2.
  */
 public function filter_data_to_save(CMB2 $cmb2, $object_id)
 {
     foreach ($cmb2->prop('fields') as $field_args) {
         if (!('group' === $field_args['type'] || array_key_exists('attributes', $field_args) && array_key_exists('data-conditional-id', $field_args['attributes']))) {
             continue;
         }
         if ('group' === $field_args['type']) {
             foreach ($field_args['fields'] as $group_field) {
                 if (!(array_key_exists('attributes', $group_field) && array_key_exists('data-conditional-id', $group_field['attributes']))) {
                     continue;
                 }
                 $field_id = $group_field['id'];
                 $conditional_id = $group_field['attributes']['data-conditional-id'];
                 $decoded_conditional_id = @json_decode($conditional_id);
                 if ($decoded_conditional_id) {
                     $conditional_id = $decoded_conditional_id;
                 }
                 if (is_array($conditional_id) && !empty($conditional_id) && !empty($cmb2->data_to_save[$conditional_id[0]])) {
                     foreach ($cmb2->data_to_save[$conditional_id[0]] as $key => $group_data) {
                         $cmb2->data_to_save[$conditional_id[0]][$key] = $this->filter_field_data_to_save($group_data, $field_id, $conditional_id[1], $group_field['attributes']);
                     }
                 }
                 continue;
             }
         } else {
             $field_id = $field_args['id'];
             $conditional_id = $field_args['attributes']['data-conditional-id'];
             $cmb2->data_to_save = $this->filter_field_data_to_save($cmb2->data_to_save, $field_id, $conditional_id, $field_args['attributes']);
         }
     }
 }