-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathswitch.php
65 lines (61 loc) · 1.72 KB
/
switch.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* This switch demo fiel
*/
add_filter( 'rwmb_meta_boxes', 'your_prefix_switch_demo' );
function your_prefix_switch_demo( $meta_boxes ) {
$meta_boxes[] = array(
'title' => __( 'Check switch rounded demo', 'textdomain' ),
'fields' => array(
array(
'type' => 'switch',
'name' => esc_html__( 'Rounded no label', 'textdomain' ),
'id' => "switch_rounded",
// Value can be 0 or 1
'std' => 1,
),
array(
'type' => 'switch',
'name' => esc_html__( 'On-Off label', 'textdomain' ),
'id' => "switch_rounded_label",
// Value can be 0 or 1
'std' => 1,
'on_label' => esc_html__( 'On', 'textdomain' ),
'off_label' => esc_html__( 'Off', 'textdomain' ),
),
array(
'type' => 'switch',
'name' => esc_html__( 'With icon', 'textdomain' ),
'id' => "switch_rounded_label_true",
// Value can be 0 or 1
'std' => 1,
'on_label' => '<span class="dashicons dashicons-yes"></span>',
'off_label' => '<span class="dashicons dashicons-no"></span>',
),
),
);
$meta_boxes[] = array(
'title' => __( 'Check switch square demo', 'textdomain' ),
'fields' => array(
array(
'id' => 'switch_square',
'name' => __( 'Square no label', 'textdomain' ),
'type' => 'switch',
'std' => 1,
'style' => 'square',
),
array(
'type' => 'switch',
'name' => esc_html__( 'Enable - Disable', 'textdomain' ),
'id' => "switch_square_label",
// Value can be 0 or 1
'std' => 1,
// 2 style: rounded and square
'style' => 'square',
'on_label' => esc_html__( 'Enable', 'textdomain' ),
'off_label' => esc_html__( 'Disable', 'textdomain' ),
),
),
);
return $meta_boxes;
}