diff --git a/inc/cmb2-tabs.class.php b/inc/cmb2-tabs.class.php index dfd863b..562c342 100644 --- a/inc/cmb2-tabs.class.php +++ b/inc/cmb2-tabs.class.php @@ -31,15 +31,15 @@ public function __construct() { * @param $object_type * @param $field_type_object */ - public function render( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { + public function render( \CMB2_Field $field_object, $escaped_value, $object_id, $object_type, \CMB2_Types $field_type_object ) { $this->setting = $field_object->args( 'tabs' ); $this->object_id = $object_id; // Set layout $layout = empty( $this->setting['layout'] ) ? 'ui-tabs-horizontal' : "ui-tabs-{$this->setting['layout']}"; - $default_data = version_compare( CMB2_VERSION, '2.2.2', '>=' ) ? [ + $default_data = version_compare( CMB2_VERSION, '2.2.2', '>=' ) ? array( 'class' => "dtheme-cmb2-tabs $layout", - ] : $field_type_object->parse_args( $field_object->data_args(), 'tabs', array( + ) : $field_type_object->parse_args( $field_object->data_args(), 'tabs', array( 'class' => "dtheme-cmb2-tabs $layout", ) ); @@ -61,19 +61,19 @@ public function get_tabs() { ob_start(); ?> - setting['tabs'] as $key => $tab ): ?> -
+
render_fields( $this->setting['config'], $tab['fields'], $this->object_id ); ?> -
+
is_options_page_mb() ) { $cmb2_options = cmb2_options( $post_id ); - $values = $CMB2->get_sanitized_values( $_POST ); - foreach ( $values as $key => $value ) { - $cmb2_options->update( $key, $value ); + $id_fields = array_map( function( $field ) { + return $field['id']; + }, $tab['fields'] ); + + foreach ( $_POST as $key => $value ) { + if ( array_search( $key, $id_fields ) !== false ) { + $cmb2_options->update( $key, $value ); + } } } else { $CMB2->save_fields(); } } } + } \ No newline at end of file