Control: Checkbox - 10quality/wpmvc-addon-metaboxer GitHub Wiki

Control used as a field type to display an HTML <input[type="checkbox"]>.

Usage

class Post extends Model
{
    // Class properties and methods...

    protected function init()
    {
        $this->metaboxes = [
            'metabox_id' => [
                'tabs' => [
                    'tab_id' => [
                        'fields' => [

                            'enabled' => [
                                'type' => 'checkbox',
                                'title' => __( 'Enabled', 'my-domain' ),
                                'description' => __( 'Checkbox additional description.', 'my-domain' ),
                                'default' => 'yes',
                                'control' => [
                                    'label' => __( 'Enable my app.', 'my-domain' ),
                                ],
                            ],

                            // Other fields...
                        ],
                    ],
                ],
            ],
        ];
    }
}

Control options

Control Data type Description
label string An additional descriptive label to be displayed next to the checkbox.