| @@ 13-86 (lines=74) @@ | ||
| 10 | * Class EmailFieldType |
|
| 11 | * @package Hechoenlaravel\JarvisFoundation\Field\Email |
|
| 12 | */ |
|
| 13 | class EmailFieldType implements FieldTypeInterface |
|
| 14 | { |
|
| 15 | use FieldTypeImplementationTrait; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @var |
|
| 19 | */ |
|
| 20 | private $value; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @var string |
|
| 24 | */ |
|
| 25 | protected $columnType = "string"; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * The field type name |
|
| 29 | * @var string |
|
| 30 | */ |
|
| 31 | public $name = "Email"; |
|
| 32 | ||
| 33 | /** |
|
| 34 | * get the column type for this field type |
|
| 35 | * @return string |
|
| 36 | */ |
|
| 37 | public function getColumnType() |
|
| 38 | { |
|
| 39 | return $this->columnType; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Set a value for this field; |
|
| 44 | * @param $value |
|
| 45 | */ |
|
| 46 | public function setValue($value) |
|
| 47 | { |
|
| 48 | $this->value = $value; |
|
| 49 | } |
|
| 50 | ||
| 51 | ||
| 52 | /** |
|
| 53 | * get the value for the field |
|
| 54 | * @return mixed |
|
| 55 | */ |
|
| 56 | public function getValue() |
|
| 57 | { |
|
| 58 | return $this->value; |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * Get the presenter class if any |
|
| 63 | * @return mixed |
|
| 64 | */ |
|
| 65 | public function present() |
|
| 66 | { |
|
| 67 | return Field::email($this->fieldSlug, $this->value, ['label' => $this->fieldName]); |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * Que the form for the options of the field type |
|
| 72 | * @return mixed |
|
| 73 | */ |
|
| 74 | public function getOptionsForm() |
|
| 75 | { |
|
| 76 | return view('jarvisPlatform::field.types.email.optionsForm')->render(); |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * @return mixed |
|
| 81 | */ |
|
| 82 | public function presentFront() |
|
| 83 | { |
|
| 84 | return $this->value; |
|
| 85 | } |
|
| 86 | } |
|
| 87 | ||
| @@ 13-86 (lines=74) @@ | ||
| 10 | * Class TextFieldType |
|
| 11 | * @package Hechoenlaravel\JarvisFoundation\Field\Text |
|
| 12 | */ |
|
| 13 | class TextAreaFieldType implements FieldTypeInterface |
|
| 14 | { |
|
| 15 | use FieldTypeImplementationTrait; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @var |
|
| 19 | */ |
|
| 20 | private $value; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @var string |
|
| 24 | */ |
|
| 25 | protected $columnType = "text"; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * The field type name |
|
| 29 | * @var string |
|
| 30 | */ |
|
| 31 | public $name = "Area de Texto"; |
|
| 32 | ||
| 33 | /** |
|
| 34 | * get the column type for this field type |
|
| 35 | * @return string |
|
| 36 | */ |
|
| 37 | public function getColumnType() |
|
| 38 | { |
|
| 39 | return $this->columnType; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Set a value for this field; |
|
| 44 | * @param $value |
|
| 45 | */ |
|
| 46 | public function setValue($value) |
|
| 47 | { |
|
| 48 | $this->value = $value; |
|
| 49 | } |
|
| 50 | ||
| 51 | ||
| 52 | /** |
|
| 53 | * get the value for the field |
|
| 54 | * @return mixed |
|
| 55 | */ |
|
| 56 | public function getValue() |
|
| 57 | { |
|
| 58 | return $this->value; |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * Get the presenter class if any |
|
| 63 | * @return mixed |
|
| 64 | */ |
|
| 65 | public function present() |
|
| 66 | { |
|
| 67 | return Field::textarea($this->fieldSlug, $this->value, ['label' => $this->fieldName]); |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * Que the form for the options of the field type |
|
| 72 | * @return mixed |
|
| 73 | */ |
|
| 74 | public function getOptionsForm() |
|
| 75 | { |
|
| 76 | return view('jarvisPlatform::field.types.textarea.optionsForm')->render(); |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * @return mixed |
|
| 81 | */ |
|
| 82 | public function presentFront() |
|
| 83 | { |
|
| 84 | return $this->value; |
|
| 85 | } |
|
| 86 | } |
|
| 87 | ||