Issues (377)

field/class-kirki-field-text.php (1 issue)

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_Text extends Kirki_Field_Kirki_Generic {
16
17
	/**
18
	 * Sets the $choices
19
	 *
20
	 * @access protected
21
	 */
22
	protected function set_choices() {
23
		if ( ! is_array( $this->choices ) ) {
0 ignored issues
show
The condition is_array($this->choices) is always true.
Loading history...
24
			$this->choices = array();
25
		}
26
		$this->choices['element'] = 'input';
27
		$this->choices['type']    = 'text';
28
	}
29
30
	/**
31
	 * Sets the $sanitize_callback
32
	 *
33
	 * @access protected
34
	 */
35
	protected function set_sanitize_callback() {
36
37
		// If a custom sanitize_callback has been defined,
38
		// then we don't need to proceed any further.
39
		if ( ! empty( $this->sanitize_callback ) ) {
40
			return;
41
		}
42
		$this->sanitize_callback = 'sanitize_textarea_field';
43
	}
44
}
45