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

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

Checkbox

Usage

// Namespace and use statement...

class Settings extends Model
{
    // Class properties...

    protected function init()
    {
        // Other properties...

        $this->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.