render_wrapper( 'accordion', $this->render_accordion(), array( 'style-' . $this->attribute['sg_accordion_style'] ) ); } /** * Render Accordion */ private function render_accordion() { $accordions = ''; $left_icon = ''; $right_icon = ''; $left_icon_normal = $this->attribute['sg_icon_left']; $left_icon_active = $this->attribute['sg_icon_left_active']; $right_icon_normal = $this->attribute['sg_icon_right']; $right_icon_active = $this->attribute['sg_icon_right_active']; $icon_position = esc_attr( $this->attribute['sg_icon_position'] ); $number = 'yes' === $this->attribute['sg_icon_number'] && 'right' === $this->attribute['sg_icon_position'] ? '' : ''; $first_expand = 'yes' === $this->attribute['sg_accordion_open'] ? 'expand' : ''; $list = $this->attribute['sg_accordion_list']; if ( 'left' === $icon_position || 'both' === $icon_position ) { $left_icon = '
'; } if ( 'right' === $icon_position || 'both' === $icon_position ) { $right_icon = ' '; } $class_wrapper = 'card-wrapper'; $class_header = 'card-header'; if ( 'gradient' === $this->attribute['st_wrapper_open_background_background_background'] || 'gradient' === $this->attribute['st_wrapper_close_background_background_background'] ) { $class_wrapper .= ' background-gradient'; } if ( 'gradient' === $this->attribute['st_title_open_background_background_background'] || 'gradient' === $this->attribute['st_title_close_background_background_background'] ) { $class_header .= ' background-gradient'; } foreach ( $list as $key => $accordion ) { $expand_id = 'expand-' . esc_attr( $accordion['_id'] ); $title = esc_attr( $accordion['sg_accordion_list_title'] ); $content = wp_kses_post( $accordion['sg_accordion_list_content'] ); $expand = 'yes' === $accordion['sg_accordion_list_open'] ? 'expand' : ''; $expand = 0 === $key && 'expand' !== $expand ? $first_expand : $expand; $style_expand = 'expand' === $expand ? 'block' : 'none'; $accordions = $accordions . ' '; } return $accordions; } }