@@ 39-48 (lines=10) @@ | ||
36 | return Html::error($this->errors->first($name)); |
|
37 | } |
|
38 | ||
39 | public function text(string $name, bool $required = false, string $locale = ''): string |
|
40 | { |
|
41 | $fieldName = $this->fieldName($name, $locale); |
|
42 | ||
43 | return $this->group([ |
|
44 | $this->label($name, $required), |
|
45 | Form::text($fieldName, Form::useInitialValue($this->model, $name, $locale)), |
|
46 | $this->error($fieldName, $this->errors), |
|
47 | ]); |
|
48 | } |
|
49 | ||
50 | public function textarea(string $name, bool $required = false, string $locale = ''): string |
|
51 | { |
|
@@ 50-59 (lines=10) @@ | ||
47 | ]); |
|
48 | } |
|
49 | ||
50 | public function textarea(string $name, bool $required = false, string $locale = ''): string |
|
51 | { |
|
52 | $fieldName = $this->fieldName($name, $locale); |
|
53 | ||
54 | return $this->group([ |
|
55 | $this->label($name, $required), |
|
56 | Form::textarea($fieldName, Form::useInitialValue($this->model, $name, $locale), ['data-autosize']), |
|
57 | $this->error($fieldName, $this->errors), |
|
58 | ]); |
|
59 | } |
|
60 | ||
61 | public function redactor(string $name, bool $required = false, string $locale = ''): string |
|
62 | { |
|
@@ 98-107 (lines=10) @@ | ||
95 | return $this->group([el('label.-checkbox', $contents)]); |
|
96 | } |
|
97 | ||
98 | public function date(string $name, bool $required = false, string $locale = ''): string |
|
99 | { |
|
100 | $fieldName = $this->fieldName($name, $locale); |
|
101 | ||
102 | return $this->group([ |
|
103 | $this->label($name, $required), |
|
104 | Form::datePicker($fieldName, Form::useInitialValue($this->model, $name, $locale)), |
|
105 | $this->error($fieldName, $this->errors), |
|
106 | ]); |
|
107 | } |
|
108 | ||
109 | public function select(string $name, $options, string $locale = ''): string |
|
110 | { |
|
@@ 109-123 (lines=15) @@ | ||
106 | ]); |
|
107 | } |
|
108 | ||
109 | public function select(string $name, $options, string $locale = ''): string |
|
110 | { |
|
111 | $fieldName = $this->fieldName($name, $locale); |
|
112 | ||
113 | return $this->group([ |
|
114 | $this->label($name, true), |
|
115 | Form::select( |
|
116 | $fieldName, |
|
117 | $options, |
|
118 | Form::useInitialValue($this->model, $name, $locale), |
|
119 | ['data-select' => 'select'] |
|
120 | ), |
|
121 | $this->error($fieldName, $this->errors), |
|
122 | ]); |
|
123 | } |
|
124 | ||
125 | public function searchableSelect(string $name, $options, string $locale = ''): string |
|
126 | { |
|
@@ 125-139 (lines=15) @@ | ||
122 | ]); |
|
123 | } |
|
124 | ||
125 | public function searchableSelect(string $name, $options, string $locale = ''): string |
|
126 | { |
|
127 | $fieldName = $this->fieldName($name, $locale); |
|
128 | ||
129 | return $this->group([ |
|
130 | $this->label($name), |
|
131 | Form::select( |
|
132 | $fieldName, |
|
133 | $options, |
|
134 | Form::useInitialValue($this->model, $name, $locale), |
|
135 | ['data-select' => 'search'] |
|
136 | ), |
|
137 | $this->error($fieldName, $this->errors), |
|
138 | ]); |
|
139 | } |
|
140 | ||
141 | public function searchableMultiSelect(string $name, $options, string $locale = ''): string |
|
142 | { |
|
@@ 141-155 (lines=15) @@ | ||
138 | ]); |
|
139 | } |
|
140 | ||
141 | public function searchableMultiSelect(string $name, $options, string $locale = ''): string |
|
142 | { |
|
143 | $fieldName = $this->fieldName($name, $locale); |
|
144 | ||
145 | return $this->group([ |
|
146 | $this->label($name), |
|
147 | Form::select( |
|
148 | $fieldName, |
|
149 | $options, |
|
150 | Form::useInitialValue($this->model, $name, $locale), |
|
151 | ['data-select' => 'search', 'multiple' => true] |
|
152 | ), |
|
153 | $this->error($fieldName, $this->errors), |
|
154 | ]); |
|
155 | } |
|
156 | ||
157 | public function tags(string $type): string |
|
158 | { |