sort_clone is not working at some points

Support MB Group sort_clone is not working at some points

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #7609
    nfyp145nfyp145
    Participant

    Hi Tan

    I use group type when creating arrays. It's much easier to read and call arrays. Below is my sample code for post meta box.

    
    <?php
    
    add_filter('rwmb_meta_boxes', 'my_post_meta_box');
    function my_post_meta_box($meta_boxes) {
        $prefix       = '';
        $meta_boxes[] = array(
            'id'         => 'my_post_meta_box_array',
            'post_types' => 'post',
            'tab_style'  => 'left',
            'tabs'       => array(
                'tab_1' => 'Custom Post',
                'tab_2' => 'Related Post',
            ),
            'title'      => 'My Post Meta Box',
            'fields'     => array(
    
                /* // CUSTOM POST
                -------------------------------------------------- */
    
                array(
                    'id'          => 'custom_post',
                    'tab'         => 'tab_1',
                    'type'        => 'group',
                    'fields'      => array(
                        array(
                            'id'   => 'title',
                            'name' => 'Title',
                            'type' => 'text',
                        ),
                        array(
                            'id'   => 'description',
                            'name' => 'Description',
                            'type' => 'textarea',
                        ),
                    ),
                ),
    
                /* // RELATED POST
                -------------------------------------------------- */
    
                array(
                    'id'          => 'related_post',
                    'tab'         => 'tab_2',
                    'type'        => 'group',
                    'fields'      => array(
                        array(
                            'id'   => 'title',
                            'name' => 'Title',
                            'type' => 'text',
                        ),
                        array(
                            'id'   => 'description',
                            'name' => 'Description',
                            'type' => 'textarea',
                        ),
                        array(
                            'clone'       => true,
                            'collapsible' => true,
                            'id'          => 'group',
                            'sort_clone'  => true,
                            'type'        => 'group',
                            'fields'      => array(
                                array(
                                    'id'   => 'title',
                                    'name' => 'Title',
                                    'type' => 'text',
                                ),
                                array(
                                    'id'   => 'description',
                                    'name' => 'Description',
                                    'type' => 'textarea',
                                ),
                                array(
                                    'id'   => 'url',
                                    'name' => 'URL',
                                    'type' => 'url',
                                ),
                            ),
                        ),
                    ),
                ),
    
            ),
        );
        return $meta_boxes;
    }
    

    At there, sort_clone from "RELATED POST" is not working. Probably, Javascript error?

    But when I put "RELATED POST" code at the top... like below... sort_clone is working.

    
    <?php
    
    add_filter('rwmb_meta_boxes', 'my_post_meta_box');
    function my_post_meta_box($meta_boxes) {
        $prefix       = '';
        $meta_boxes[] = array(
            'id'         => 'my_post_meta_box_array',
            'post_types' => 'post',
            'tab_style'  => 'left',
            'tabs'       => array(
                'tab_1' => 'Custom Post',
                'tab_2' => 'Related Post',
            ),
            'title'      => 'My Post Meta Box',
            'fields'     => array(
    
                /* // RELATED POST
                -------------------------------------------------- */
    
                array(
                    'id'          => 'related_post',
                    'tab'         => 'tab_2',
                    'type'        => 'group',
                    'fields'      => array(
                        array(
                            'id'   => 'title',
                            'name' => 'Title',
                            'type' => 'text',
                        ),
                        array(
                            'id'   => 'description',
                            'name' => 'Description',
                            'type' => 'textarea',
                        ),
                        array(
                            'clone'       => true,
                            'collapsible' => true,
                            'id'          => 'group',
                            'sort_clone'  => true,
                            'type'        => 'group',
                            'fields'      => array(
                                array(
                                    'id'   => 'title',
                                    'name' => 'Title',
                                    'type' => 'text',
                                ),
                                array(
                                    'id'   => 'description',
                                    'name' => 'Description',
                                    'type' => 'textarea',
                                ),
                                array(
                                    'id'   => 'url',
                                    'name' => 'URL',
                                    'type' => 'url',
                                ),
                            ),
                        ),
                    ),
                ),
    
                /* // CUSTOM POST
                -------------------------------------------------- */
    
                array(
                    'id'          => 'custom_post',
                    'tab'         => 'tab_1',
                    'type'        => 'group',
                    'fields'      => array(
                        array(
                            'id'   => 'title',
                            'name' => 'Title',
                            'type' => 'text',
                        ),
                        array(
                            'id'   => 'description',
                            'name' => 'Description',
                            'type' => 'textarea',
                        ),
                    ),
                ),
    
            ),
        );
        return $meta_boxes;
    }
    

    Could you please help me with that issue?

    Thank you so much Tan!

    #7620
    Anh TranAnh Tran
    Keymaster

    Thanks, I will check it now.

    #7622
    nfyp145nfyp145
    Participant

    Appreciate for the reply Tan.

    Eagerly Waiting...

    #7771
    Anh TranAnh Tran
    Keymaster

    I've found the bug and fixed it in version 1.2.12 of Group extension. Please update.

    #7785
    nfyp145nfyp145
    Participant

    Sorry for late confrim.

    It works well now. Thank you so much and appreciate for the fix.

    Happy Holidays Tan!

    #7787
    Anh TranAnh Tran
    Keymaster

    Great! Happy holidays 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘sort_clone is not working at some points’ is closed to new replies.