| @@ 41-53 (lines=13) @@ | ||
| 38 | $this->value = 1; |
|
| 39 | } |
|
| 40 | ||
| 41 | protected function addClasses() |
|
| 42 | { |
|
| 43 | // Specific to Bootstrap, will need to abstract it |
|
| 44 | $this->class[] = 'custom-control-input'; |
|
| 45 | $this->labelClass[] = 'custom-control-label'; |
|
| 46 | ||
| 47 | // Attach the error class if an error is displayed against this field |
|
| 48 | $errors = session()->get('errors', app(ViewErrorBag::class)); |
|
| 49 | if ($errors->has($this->name)) { |
|
| 50 | $this->labelClass[] = config('blade-form-components.styles.field.error'); |
|
| 51 | } |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| @@ 192-205 (lines=14) @@ | ||
| 189 | } |
|
| 190 | } |
|
| 191 | ||
| 192 | protected function setClass() |
|
| 193 | { |
|
| 194 | // Default class applied to all form elements (Eg 'form-control' for Bootstrap) |
|
| 195 | $this->class[] = config('blade-form-components.styles.field.input'); |
|
| 196 | ||
| 197 | // Attach the error class if an error is displayed against this field |
|
| 198 | $errors = session()->get('errors', app(ViewErrorBag::class)); |
|
| 199 | if ($errors->has($this->name)) { |
|
| 200 | $this->class[] = config('blade-form-components.styles.field.error'); |
|
| 201 | } |
|
| 202 | ||
| 203 | // Attach other user-defined classes |
|
| 204 | } |
|
| 205 | ||
| 206 | public function glueAttributes() |
|
| 207 | { |
|
| 208 | $pairs = []; |
|