| @@ 8-52 (lines=45) @@ | ||
| 5 | use Helmut\Forms\Field; |
|
| 6 | use Helmut\Forms\Utility\Validate; |
|
| 7 | ||
| 8 | class ParagraphText extends Field { |
|
| 9 | ||
| 10 | protected $value = ''; |
|
| 11 | ||
| 12 | public function getValue() |
|
| 13 | { |
|
| 14 | return $this->value; |
|
| 15 | } |
|
| 16 | ||
| 17 | public function getButtonName() |
|
| 18 | { |
|
| 19 | // |
|
| 20 | } |
|
| 21 | ||
| 22 | public function renderWith() |
|
| 23 | { |
|
| 24 | return ['value' => $this->value]; |
|
| 25 | } |
|
| 26 | ||
| 27 | public function setValueFromDefault() |
|
| 28 | { |
|
| 29 | $this->value = $this->default; |
|
| 30 | } |
|
| 31 | ||
| 32 | public function setValueFromModel($model) |
|
| 33 | { |
|
| 34 | if (isset($model->{$this->name})) $this->value = $model->{$this->name}; |
|
| 35 | } |
|
| 36 | ||
| 37 | public function setValueFromRequest($request) |
|
| 38 | { |
|
| 39 | $this->value = $request->get($this->name); |
|
| 40 | } |
|
| 41 | ||
| 42 | public function fillModelWithValue($model) |
|
| 43 | { |
|
| 44 | $model->{$this->name} = $this->value; |
|
| 45 | } |
|
| 46 | ||
| 47 | public function validateRequired() |
|
| 48 | { |
|
| 49 | return Validate::required($this->value); |
|
| 50 | } |
|
| 51 | ||
| 52 | } |
|
| @@ 8-52 (lines=45) @@ | ||
| 5 | use Helmut\Forms\Field; |
|
| 6 | use Helmut\Forms\Utility\Validate; |
|
| 7 | ||
| 8 | class Search extends Field { |
|
| 9 | ||
| 10 | protected $value = ''; |
|
| 11 | ||
| 12 | public function getValue() |
|
| 13 | { |
|
| 14 | return $this->value; |
|
| 15 | } |
|
| 16 | ||
| 17 | public function getButtonName() |
|
| 18 | { |
|
| 19 | return $this->name.'_button'; |
|
| 20 | } |
|
| 21 | ||
| 22 | public function renderWith() |
|
| 23 | { |
|
| 24 | return ['value' => $this->value]; |
|
| 25 | } |
|
| 26 | ||
| 27 | public function setValueFromDefault() |
|
| 28 | { |
|
| 29 | $this->value = $this->default; |
|
| 30 | } |
|
| 31 | ||
| 32 | public function setValueFromModel($model) |
|
| 33 | { |
|
| 34 | if (isset($model->{$this->name})) $this->value = $model->{$this->name}; |
|
| 35 | } |
|
| 36 | ||
| 37 | public function setValueFromRequest($request) |
|
| 38 | { |
|
| 39 | $this->value = $request->get($this->name); |
|
| 40 | } |
|
| 41 | ||
| 42 | public function fillModelWithValue($model) |
|
| 43 | { |
|
| 44 | $model->{$this->name} = $this->value; |
|
| 45 | } |
|
| 46 | ||
| 47 | public function validateRequired() |
|
| 48 | { |
|
| 49 | return Validate::required($this->value); |
|
| 50 | } |
|
| 51 | ||
| 52 | } |
|