Control: Switch
Ale Mostajo edited this page Apr 29, 2020
·
1 revision
Control used as a field type to display a on/off switch.
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...
],
],
],
],
];
}
}
(c) 2020 10 Quality Studio.