1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace EventEspresso\core\services\form\meta\inputs; |
4
|
|
|
|
5
|
|
|
class Input |
6
|
|
|
{ |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* indicates that the HTML input type is 'checkbox' |
10
|
|
|
*/ |
11
|
|
|
public const TYPE_CHECKBOX = 'checkbox'; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* indicates that the HTML input type is 'color' |
15
|
|
|
*/ |
16
|
|
|
public const TYPE_COLOR = 'color'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* indicates that the HTML input type is 'file' |
20
|
|
|
*/ |
21
|
|
|
public const TYPE_FILE = 'file'; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* indicates that the HTML input type is 'hidden' |
25
|
|
|
*/ |
26
|
|
|
public const TYPE_HIDDEN = 'hidden'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* indicates that the HTML input type is 'image' |
30
|
|
|
*/ |
31
|
|
|
public const TYPE_IMAGE = 'image'; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* indicates that the HTML input type is 'password' |
35
|
|
|
*/ |
36
|
|
|
public const TYPE_PASSWORD = 'password'; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* indicates that the HTML input type is 'radio' |
40
|
|
|
*/ |
41
|
|
|
public const TYPE_RADIO = 'radio'; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* indicates that the HTML input type is 'url' |
45
|
|
|
*/ |
46
|
|
|
public const TYPE_URL = 'url'; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var array |
50
|
|
|
*/ |
51
|
|
|
private $valid_type_options; |
52
|
|
|
|
53
|
|
|
|
54
|
|
|
public function __construct() |
55
|
|
|
{ |
56
|
|
|
$this->valid_type_options = apply_filters( |
57
|
|
|
'FHEE__EventEspresso_core_services_form_meta_inputs_Input__valid_type_options', |
58
|
|
|
[ |
59
|
|
|
Input::TYPE_CHECKBOX => esc_html__('Checkbox', 'event_espresso'), |
60
|
|
|
Input::TYPE_COLOR => esc_html__('Color Picker', 'event_espresso'), |
61
|
|
|
Input::TYPE_FILE => esc_html__('File Upload', 'event_espresso'), |
62
|
|
|
Input::TYPE_HIDDEN => esc_html__('Hidden', 'event_espresso'), |
63
|
|
|
Input::TYPE_IMAGE => esc_html__('Image Upload', 'event_espresso'), |
64
|
|
|
Input::TYPE_PASSWORD => esc_html__('Password', 'event_espresso'), |
65
|
|
|
Input::TYPE_RADIO => esc_html__('Radio Button', 'event_espresso'), |
66
|
|
|
Input::TYPE_URL => esc_html__('URL', 'event_espresso'), |
67
|
|
|
] |
68
|
|
|
); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param bool $constants_only |
74
|
|
|
* @return array |
75
|
|
|
*/ |
76
|
|
|
public function validTypeOptions(bool $constants_only = false): array |
77
|
|
|
{ |
78
|
|
|
return $constants_only |
79
|
|
|
? array_keys($this->valid_type_options) |
80
|
|
|
: $this->valid_type_options; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|