Kirki_Field_Dashicons   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A set_sanitize_callback() 0 8 2
A set_type() 0 2 1
1
<?php
2
/**
3
 * Override field methods
4
 *
5
 * @package     Kirki
6
 * @subpackage  Controls
7
 * @copyright   Copyright (c) 2017, Aristeides Stathopoulos
8
 * @license    https://opensource.org/licenses/MIT
9
 * @since       2.2.7
10
 */
11
12
/**
13
 * Field overrides.
14
 */
15
class Kirki_Field_Dashicons extends Kirki_Field {
16
17
	/**
18
	 * Sets the control type.
19
	 *
20
	 * @access protected
21
	 */
22
	protected function set_type() {
23
		$this->type = 'kirki-dashicons';
24
	}
25
26
	/**
27
	 * Sets the $sanitize_callback
28
	 *
29
	 * @access protected
30
	 */
31
	protected function set_sanitize_callback() {
32
33
		// If a custom sanitize_callback has been defined,
34
		// then we don't need to proceed any further.
35
		if ( ! empty( $this->sanitize_callback ) ) {
36
			return;
37
		}
38
		$this->sanitize_callback = 'sanitize_text_field';
39
	}
40
}
41