• Resolved CodeCans

    (@mr_sagar)


    Hi,
    Textarea field working when i use it decode.
    array(
    ‘type’ => ‘textarea’,
    ‘label’ => __( ‘Modal Box Description’ ‘kingcomposer’,
    ‘name’ => ‘acc_descr’,
    ‘description’ => __( ‘Description of the Modal Box.’,’kingcomposer’,
    ‘admin_label’ => true,
    ),
    its working when i use for normal option without repeatable field: $acc_descr = base64_decode( $atts[‘acc_descr’] );

    ================================

    But When i use Group Field with repeatable option with:
    $options = json_decode( base64_decode( $atts[‘options’] ) );
    // Text area Decode
    $acc_descr = base64_decode( $atts[‘acc_descr’]

    if( isset( $options ) ){
    foreach( $options as $option ){
    echo $option->acc_descr;
    }
    }
    It not working and showing unexpected text
    Please help

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author king-theme

    (@kingthemes)

    Hi!

    From version 2.3.1, the group field will not need to decode base64.

    And for better help, would you can paste full of your map here? Then I can check the incorrection.

    Hi, i am using the latest version 2.3.1 and still not working. Here is my full map

    global $kc;
        $kc->add_map(
            array(
                'usa_accordion' => array(
                    'name' => 'Accordion',
                    'description' => __('Modern style accordion', 'KingComposer'),
                    'icon' => 'fa-ellipsis-h',
                    'css_box' => true,
                    'category' => 'Ultimate Shortcodes Addon',
                    'params' => array(
    
    				// Title Background Color
                        array(
                            'name' => 'title_bg_color',
                            'label' => 'Title Background Color',
                            'type' => 'color_picker',
                            'admin_label' => true,
                        ),
    
    					//Description Background Color
    				array(
                            'name' => 'descr_bg_color',
                            'label' => 'Description Background Color',
                            'type' => 'color_picker',
                            'admin_label' => true,
                        ),
    
    					array(
                            'name' => 't_f_size',
                            'label' => 'Title Font Size',
                            'type' => 'number_slider',
                            'options' => array(
                                'min' => 1,
                                'max' => 50,
                                'unit' => 'px',
                                'show_input' => true,
    
                            ),
                            'value' => '18'
                        ),
    
    					array(
                            'name' => 'd_f_size',
                            'label' => 'Description Font Size',
                            'type' => 'number_slider',
                            'options' => array(
                                'min' => 1,
                                'max' => 30,
                                'unit' => 'px',
                                'show_input' => true,
    
                            ),
                            'value' => '14'
                        ),
    
                		array(
                            'type'            => 'group',
                            'label'            => __('Add Accordion Items', 'KingComposer'),
                            'name'            => 'acoptions',
                            'description'    => __( 'Repeat this fields', 'KingComposer' ),
                            'params' => array(
                                    array(
                                        'name' => 'title',
                                        'label' => 'Title',
                                        'type' => 'text',
                						'value' => 'title goes here',
                                    ),
                                    array(
                                        'name' => 'descr',
                                        'label' => 'Description',
                                        'type' => 'editor',
                						'value' => base64_encode( 'description goes here' ),
                                    ),
                    				array(
                                        'name' => 'act_accordion',
                                        'label' => 'Active Item?',
                                        'type' => 'checkbox',
                                        'options' => array(
                                        'active' => 'Yes',
                                        )
                                        ),
                					),
                				),	
    
                    )
                )
            )
        );

    input was “222222222” and output is “PHA+MjIyMjIyMjIyMjI8L3A+”

    Please check it asap.

    Thanks

    also, without decode base64 not working

    $options = json_decode ( $atts['options'] );

    Plugin Author king-theme

    (@kingthemes)

    Hi!

    I tested your map with my code bellow

    $acoptions = json_decode($atts['acoptions'], true); // decode json as array
    echo base64_decode( $acoptions[1]['descr'] );

    It works, but you make my new idea. I’ll also decode for children fields of “group” so that developers will easier to use.

    Plugin Author king-theme

    (@kingthemes)

    I’ve updated the plugin to version 2.3.2, please update all of your elements.

    From this version, you’ll not need to care about decode.

    – “editor” will return as string
    – “group” will return as array() and all children field also decode before return to your template
    – “textarea” will return as string
    – “textarea_html” will work with 3rd party elements. But it’s a special type, read document carefully before use it.
    – After add_map, just create a template file: /your_theme/kingcomposer/{shortcode_name}.php

    Please let me know if you found any more trouble.

    Thank You so much for helping us!

    Thread Starter CodeCans

    (@mr_sagar)

    Hi,
    Thanks for trying to solve issue quickly, as disappointed, I don’t know what you are fixed.
    1.
    I have teken a Editor Field in Group see here:

    array(
                'type'            => 'group',
                'label'            => __('Add Accordion Items', 'KingComposer'),
                'name'            => 'acoptions',
                'description'    => __( 'Repeat this fields with each item created, Each item corresponding processbar element.', 'KingComposer' ),
                'params' => array(
                        array(
                            'name' => 'title',
                            'label' => 'Title',
                            'type' => 'text',
    						'value' => 'Title Goes Here',
                        ),
    
                    array(
                        'type'          => 'editor',
                        'label'         => __( 'Modal Box Description', 'kingcomposer' ),
                        'name'          => 'acc_descr',
                        'description'   => __( 'Description of the Modal Box.', 'kingcomposer' ),
                        'admin_label'   => true,
                    ),
    				array(
                            'name' => 'act_accordion',
                            'label' => 'Active Items',
                            'type' => 'checkbox',
                            'options' => array(
                         'active' => 'Yes',
                            )
                        ),
    					),
    				),
    
    ============================
    function usa_accordion_shortcode($atts, $content = null){
        extract( shortcode_atts( array(
            'acc_descr' => '',
        ), $atts) );
    $acoptions = json_decode( base64_decode( $atts['acoptions'] ) );
     //$acc_descr = base64_decode( $atts['acc_descr'] );
    // Need to decode before use
    $output = '<div class="accordion-wrapper">';
    if( isset( $acoptions ) ){
      foreach( $acoptions as $option ){
       $output .= '
        <div" class="ac-content">
           <p>'.$option->acc_descr.'</p>
        </div>';
    
      }
    }
    $output .='</div>';       
    
        return $output;
    }

    Tying to get Group Field Value from Avobe Code. I input 1111 But get value like this: https://prntscr.com/b6cmqb

    But When i trying to get Value in Output its still showing unexpected text in output.

    Thread Starter CodeCans

    (@mr_sagar)

    Hi, Also If i use “textarea_html” Field.
    Than it will showing Value of Last items.
    Example:
    1st item i have added in description field “Movie 1”
    3st item i have added in description field “Games 2”
    3rd item i have added in description field “Music 3”
    i added 3 items with Group field with different text but showing output same in 3 items.
    in All items out is same showing “Music 3”
    see here : https://prntscr.com/b6cyvc

    Thread Starter CodeCans

    (@mr_sagar)

    Also If i use “textarea” field only is its not showing what i input.
    i was input 1111 but see output: https://prntscr.com/b6d17i

    Please i hardly request to you just fix 1 only otherwise we don’t work to make description Dynamic.
    Thanks for advance
    RD Development

    Hi, i know this is misunderstanding between us. Its my request please write down a clear documentation about return data of group, group editor field, group text_area field. Also clear, how to return group fields data with foreach loop like,

    if( isset( $options ) ){
      foreach( $options as $option ){
         echo $option->editor_field_id
      }
    }

    Its really confusing me and maybe other developer. I am making addons as a plugin right now. Hope you can help us asap.

    Thanks for hard work. Have a great success.

    Plugin Author king-theme

    (@kingthemes)

    Hi There!

    @wpeffects: yeh, you know what? The feedbacks from developers like you is very important for us. Thank you!

    I’ve updated the plugin to version 2.3.4 and this is the last update for field trouble. Please note that there are differences between the using template & function to out put shortcode.

    Read more here https://docs.kingcomposer.com/available-param-types/group-fields/

    @rd Development: Please update the plugin to version 2.3.4, this update is fixing that trouble for you. And make sure that you are using the template file to display shortcode. If you use function via add_shortcode() to display, so you need to use base64_decode() before use. Read more https://docs.kingcomposer.com/available-param-types/group-fields/

    Thread Starter CodeCans

    (@mr_sagar)

    Super Explain. It’s working now without base64_decode.
    Thanks for your nice suppport

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Textarea not working in Group Option’ is closed to new replies.