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
66
|
<?php // phpcs:ignoreFile
namespace AutomateWoo\Fields;
if ( ! defined( 'ABSPATH' ) ) exit;
/** * @class Text */ class Text extends Field {
protected $name = 'text_input';
protected $type = 'text';
public $multiple = false;
/** * Define whether HTML entities should be decoded before the field is rendered. * * @since 4.4.0 * * @var bool */ public $decode_html_entities_before_render = true;
function __construct() { parent::__construct(); $this->title = __( 'Text Input', 'automatewoo' ); }
/** * @param bool $multi * * @return $this */ function set_multiple( $multi = true ) { $this->multiple = $multi; return $this; }
/** * Output the field HTML. * * @param string $value */ function render( $value ) { if ( $this->decode_html_entities_before_render ) { $value = html_entity_decode( $value ); } ?> <input type="<?php echo esc_attr( $this->get_type() ) ?>" name="<?php echo esc_attr( $this->get_full_name() ) ?><?php echo $this->multiple ? '[]' : '' ?>" value="<?php echo esc_attr( $value ); ?>" class="<?php echo esc_attr( $this->get_classes() ); ?>" placeholder="<?php echo esc_attr( $this->get_placeholder() ) ?>" <?php $this->output_extra_attrs(); ?> <?php echo ( $this->get_required() ? 'required' : '' ) ?> > <?php }
}
|