|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Yiisoft\Form; |
|
6
|
|
|
|
|
7
|
|
|
final class FieldFactoryConfig |
|
8
|
|
|
{ |
|
9
|
|
|
private ?string $template = null; |
|
10
|
|
|
|
|
11
|
|
|
private ?bool $setInputIdAttribute = null; |
|
12
|
|
|
|
|
13
|
|
|
private array $labelConfig = []; |
|
14
|
|
|
private array $hintConfig = []; |
|
15
|
|
|
private array $errorConfig = []; |
|
16
|
|
|
|
|
17
|
|
|
private array $inputTextConfig = []; |
|
18
|
|
|
|
|
19
|
|
|
public function template(?string $template): self |
|
20
|
|
|
{ |
|
21
|
|
|
$new = clone $this; |
|
22
|
|
|
$new->template = $template; |
|
23
|
|
|
return $new; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function setInputIdAttribute(?bool $value): self |
|
27
|
|
|
{ |
|
28
|
|
|
$new = clone $this; |
|
29
|
|
|
$new->setInputIdAttribute = $value; |
|
30
|
|
|
return $new; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function labelConfig(array $config): self |
|
34
|
|
|
{ |
|
35
|
|
|
$new = clone $this; |
|
36
|
|
|
$new->labelConfig = $config; |
|
37
|
|
|
return $new; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function hintConfig(array $config): self |
|
41
|
|
|
{ |
|
42
|
|
|
$new = clone $this; |
|
43
|
|
|
$new->hintConfig = $config; |
|
44
|
|
|
return $new; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function errorConfig(array $config): self |
|
48
|
|
|
{ |
|
49
|
|
|
$new = clone $this; |
|
50
|
|
|
$new->errorConfig = $config; |
|
51
|
|
|
return $new; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function inputTextConfig(array $config): self |
|
55
|
|
|
{ |
|
56
|
|
|
$new = clone $this; |
|
57
|
|
|
$new->inputTextConfig = $config; |
|
58
|
|
|
return $new; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function getTemplate(): ?string |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->template; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function getSetInputIdAttribute(): ?bool |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->setInputIdAttribute; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function getLabelConfig(): array |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->labelConfig; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function getHintConfig(): array |
|
77
|
|
|
{ |
|
78
|
|
|
return $this->hintConfig; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
public function getErrorConfig(): array |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->errorConfig; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
public function getInputTextConfig(): array |
|
87
|
|
|
{ |
|
88
|
|
|
return $this->inputTextConfig; |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|