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

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

Radio

Usage

// Namespace and use statement...

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

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

        $this->tabs = [
            'tab_id' => [
                'fields' => [

                    'my_radio' => [
                        'type' => 'radio',
                        'title' => __( 'My radio field', 'my-domain' ),
                        'options' => [
                            'a' => __( 'Option A', 'my-domain' ),
                            'b' => __( 'Option B', 'my-domain' ),
                            'c' => __( 'Option C', 'my-domain' ),
                        ],
                    ],

                    'left_right' => [
                        'type' => 'input',
                        'title' => __( 'Left or right', 'my-domain' ),
                        'default' => 'left',
                        'description' => __( 'Radio control (radio group example).' ),
                        'options' => [
                            'left' => 'Left',
                            'right' => 'Right',
                        ],
                        'control' => [
                            'direction' => 'column',
                        ],
                    ],

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

Control options

Control Data type Description
direction string Horizontal row (default). vertical column.