-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathicomoon-v5.php
59 lines (53 loc) · 1.49 KB
/
icomoon-v5.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
<?php
if ( ! defined( 'ABSPATH' ) ) {
die();
}
class acf_field_icomoon extends acf_field_icomoon_base {
/*
* render_field()
*
* Create the HTML interface for your field
*
* @param $field - an array holding all the field's data
*
* @type action
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// create Field HTML
?>
<input class="widefat acf-<?php echo esc_attr( $field['type'] ); ?>"
value="<?php echo esc_attr( $field['value'] ); ?>"
name="<?php echo esc_attr( $field['name'] ); ?>"
data-placeholder="<?php _e( 'Select an icon', 'acf-icomoon' ); ?>"
data-allow-clear="<?php echo esc_attr( $field['allow_clear'] ) ?>"/>
<?php
}
/*
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field.
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
*
* @type action
* @since 3.6
* @date 23/01/13
*
* @param $field - an array holding all the field's data
*/
function render_field_settings( $field ) {
// allow clear
acf_render_field_setting( $field,
array(
'label' => __( 'Display clear button?', 'acf-icomoon' ),
'instructions' => __( 'Whether or not a clear button is displayed when the select box has a selection.', 'acf-icomoon' ),
'name' => 'allow_clear',
'type' => 'true_false',
'ui' => 1,
)
);
}
}
// create field
new acf_field_icomoon();