Add more button on the top of the group

Support MB Group Add more button on the top of the group

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3558
    weseoweseo
    Participant

    Hello, is it possible to put the add more button on the top of the group?
    I have a group called "versions", when i create a new version (add more) this version should be automatically on the top.

    Big thanks

    #3561
    Anh TranAnh Tran
    Keymaster

    You can use filters to move the add more button to the top of the group:

    add_filter( 'rwmb_FIELD_ID_begin_html', function( $output, $field ) {
        $output .= RWMB_Clone::add_clone_button( $field );
        return $output;
    }, 10, 2 );
    add_filter( 'rwmb_FIELD_ID_end_html', function( $output, $field ) {
        return RWMB_Field::call( 'element_description', $field ) . '</div>';
    } );

    Note that this doesn't change the behaviour of the button, e.g. when clicking on it, the new clone will be added to the bottom of the group.

    #3581
    weseoweseo
    Participant

    Hello, thank you for your reply.
    The button is now on the top of the group with this code (new group version):

    add_filter( 'rwmb_FIELD_ID_begin_html', function( $output, $field ) {
        $output .= RWMB_Group_Field::add_clone_button( $field );
        return $output;
    }, 10, 2 );

    But is it possible to add the new clone on the top of the group?

    Thank you

    #3590
    Anh TranAnh Tran
    Keymaster

    Ah, yes, you’re right. The code I posted above is for the dev version on Github 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Add more button on the top of the group’ is closed to new replies.