Control: Switch - 10quality/wpmvc-addon-administrator GitHub Wiki
Control used as a field type to display a on/off switch.
Usage
// Namespace and use statement...
class Settings extends Model
{
// Class properties...
protected function init()
{
// Other properties...
$this->tabs = [
'tab_id' => [
'fields' => [
'field_id' => [
'type' => 'switch',
'title' => __( 'Switch', 'my-domain' ),
'default' => true,
],
'is_on' => [
'type' => 'switch',
'title' => __( 'Switch 2', 'my-domain' ),
'description' => __( 'On / Off switch.' ),
'default' => false,
],
// Other fields...
],
],
];
}
}