|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace LCI\Blend\Helpers; |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
class ElementProperty |
|
7
|
|
|
{ |
|
8
|
|
|
/** @var string */ |
|
9
|
|
|
protected $area = ''; |
|
10
|
|
|
|
|
11
|
|
|
/** @var string */ |
|
12
|
|
|
protected $description = ''; // description or desc?? |
|
13
|
|
|
|
|
14
|
|
|
/** @var null|string */ |
|
15
|
|
|
protected $lexicon = null; |
|
16
|
|
|
|
|
17
|
|
|
/** @var string */ |
|
18
|
|
|
protected $name; |
|
19
|
|
|
|
|
20
|
|
|
/** @var array ~ only for color and list */ |
|
21
|
|
|
protected $options = []; |
|
22
|
|
|
|
|
23
|
|
|
/** @var string ~ combo-boolean, textfield, textarea, datefield, list, , numberfield, file, color */ |
|
24
|
|
|
protected $type = 'textfield'; // xtype, type |
|
25
|
|
|
|
|
26
|
|
|
/** @var mixed */ |
|
27
|
|
|
protected $value; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* ElementProperty constructor. |
|
31
|
|
|
* @param $name |
|
32
|
|
|
*/ |
|
33
|
|
|
public function __construct($name) |
|
34
|
|
|
{ |
|
35
|
|
|
$this->name = $name; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @return string |
|
40
|
|
|
*/ |
|
41
|
|
|
public function getName(): string |
|
42
|
|
|
{ |
|
43
|
|
|
return $this->name; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @return array |
|
48
|
|
|
*/ |
|
49
|
|
|
public function toArray() |
|
50
|
|
|
{ |
|
51
|
|
|
return [ |
|
52
|
|
|
'name' => $this->name, |
|
53
|
|
|
'desc' => $this->description, |
|
54
|
|
|
'type' => $this->type, |
|
55
|
|
|
'options' => $this->options, |
|
56
|
|
|
'value' => $this->value, |
|
57
|
|
|
'lexicon' => $this->lexicon, |
|
58
|
|
|
'area' => $this->area |
|
59
|
|
|
]; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @param string $area |
|
64
|
|
|
* @return ElementProperty |
|
65
|
|
|
*/ |
|
66
|
|
|
public function setArea(string $area): ElementProperty |
|
67
|
|
|
{ |
|
68
|
|
|
$this->area = $area; |
|
69
|
|
|
return $this; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param string $description |
|
74
|
|
|
* @return ElementProperty |
|
75
|
|
|
*/ |
|
76
|
|
|
public function setDescription(string $description): ElementProperty |
|
77
|
|
|
{ |
|
78
|
|
|
$this->description = $description; |
|
79
|
|
|
return $this; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @param null|string $lexicon |
|
84
|
|
|
* @return ElementProperty |
|
85
|
|
|
*/ |
|
86
|
|
|
public function setLexicon(string $lexicon): ElementProperty |
|
87
|
|
|
{ |
|
88
|
|
|
$this->lexicon = $lexicon; |
|
89
|
|
|
return $this; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @param array $options |
|
94
|
|
|
* only valid for color and list |
|
95
|
|
|
* @return ElementProperty |
|
96
|
|
|
*/ |
|
97
|
|
|
public function setOptions(array $options): ElementProperty |
|
98
|
|
|
{ |
|
99
|
|
|
$this->options = $options; |
|
100
|
|
|
return $this; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* @param string $type |
|
105
|
|
|
* combo-boolean, textfield, textarea, datefield, list, , numberfield, file, color |
|
106
|
|
|
* @return ElementProperty |
|
107
|
|
|
*/ |
|
108
|
|
|
public function setType(string $type): ElementProperty |
|
109
|
|
|
{ |
|
110
|
|
|
$this->type = $type; |
|
111
|
|
|
return $this; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @param mixed $value |
|
116
|
|
|
* @return ElementProperty |
|
117
|
|
|
*/ |
|
118
|
|
|
public function setValue($value) |
|
119
|
|
|
{ |
|
120
|
|
|
$this->value = $value; |
|
121
|
|
|
return $this; |
|
122
|
|
|
} |
|
123
|
|
|
} |