tabs ) ) { foreach ( $this->tabs as $value => $args ) { $this->controls[ $value ] = $args['controls']; } } } /** * Controls array from tabs. * * @var array */ public $controls = array(); /** * The type of customize control being rendered. */ public $type = 'group-field'; /** * The type refresh being used. */ public $transport = 'postMessage'; /** * The priority of the control. */ public $priority = -10; /** * The tabs with keys of the controls that are under each tab. */ public $tabs; /** * Displays the control content. */ public function render_content() { /* If no tabs are provided, bail. */ if ( empty( $this->tabs ) ) { return; } $output = ''; $output .= '
'; foreach ( $this->tabs as $value => $args ) { if ( ! empty( $args['controls'] ) ) { $controls_attribute = json_encode( $args['controls'] ); $output .= '
'; $output .= 'id}" ) . '" '; $output .= 'id="' . esc_attr( "{$this->id}-{$value}" ) . '" '; $output .= 'data-controls="' . esc_js( $controls_attribute ) . '" '; $output .= 'data-preview="' . esc_js( $value ) . '" '; if ( ! empty( $args['active_tab'] ) && ( $args['active_tab'] == true ) ) { $class = 'class="active"'; } else { $class = 'class="inactive"'; } $output .= $class; $output .= '/>'; $label_classes = ''; foreach ( $args['controls'] as $control_id ) { $label_classes .= esc_attr( $control_id . ' ' ); } $output .= ''; $output .= '
'; } } $output .= '
'; echo $output; } /** * Loads the scripts and hooks our custom styles in. */ public function enqueue() { if ( empty( $this->tabs ) ) { return; } wp_enqueue_script( 'bizness-customize-group-field-control', BIZNESS_THEME_URI . 'inc/customizer/controls/group-field/script.js', [ 'jquery' ], BIZNESS_THEME_VERSION, true ); } }