Control: Switch - 10quality/wpmvc-addon-metaboxer GitHub Wiki
Control used as a field type to display a on/off switch.
Usage
class Post extends Model
{
// Class properties and methods...
protected function init()
{
$this->metaboxes = [
'metabox_id' => [
'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...
],
],
],
],
];
}
}