Bug: backup field does not work inside a group field

Support MB Settings Page Bug: backup field does not work inside a group field

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36516
    RodrigoRodrigo
    Participant

    Hi,

    The code below triggers a fatal error in PHP 8 and a warning in PHP 7.4 or lower.

    
    add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) {
        $meta_boxes[] = [
            'id'             => 'general',
            'title'          => 'General',
            'settings_pages' => 'my-options',
            'context'        => 'normal',
            'fields'         => [
                [
                    'id'     => 'my_group',
                    'type'   => 'group',
                    'clone'  => false,
                    'fields' => [
                        [
                            'name' => 'Backup',
                            'type' => 'backup',
                        ],
                    ]
                ]
            ]
        ];
        return $meta_boxes;
    } );
    
    ( ! ) Fatal error: Uncaught TypeError: get_class(): Argument #1 ($object) must be of type object, null given in /(...)/meta-box-aio/vendor/meta-box/mb-settings-page/src/BackupField.php on line 4
    

    It works fine without the group field.

    Here's a quick video displaying the bug: https://youtu.be/GylF4X20kyE

    And a test plugin: https://dl.dropbox.com/s/6weozndvcc6jbo3/test-plugin.zip

    I look forward to the resolution of the issue, thanks.

    #36525
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Thanks for your feedback.

    I think that a backup field should not be registered as a subfield in a group and I will create a note in the documentation for this case. But I will also inform the development team to explore the possibility.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.