Factory
5 years ago
FieldCollection
5 years ago
FormField
5 years ago
FormFieldMediator
5 years ago
FieldCollection.php
5 years ago
FormField.php
5 years ago
FormField.php
49 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Framework\FieldsAPI; |
| 4 | |
| 5 | use Give\Framework\FieldsAPI\FieldCollection\Contract\Node; |
| 6 | |
| 7 | class FormField implements Node { |
| 8 | |
| 9 | use FormField\FieldLabel; |
| 10 | use FormField\FieldOptions; |
| 11 | use FormField\FieldRequired; |
| 12 | use FormField\FieldReadOnly; |
| 13 | use FormField\FieldHelpText; |
| 14 | use FormField\FieldDefaultValue; |
| 15 | use FormField\FieldAttributes; |
| 16 | use FormField\FieldEmailTag; |
| 17 | use FormField\FieldStoreAsMeta; |
| 18 | use FormField\FieldReceipt; |
| 19 | |
| 20 | /** @var string */ |
| 21 | protected $type; |
| 22 | |
| 23 | /** @var string */ |
| 24 | protected $name; |
| 25 | |
| 26 | public function __construct( $type, $name ) { |
| 27 | $this->type = $type; |
| 28 | $this->name = $name; |
| 29 | } |
| 30 | |
| 31 | public function getType() { |
| 32 | return $this->type; |
| 33 | } |
| 34 | |
| 35 | public function getName() { |
| 36 | return $this->name; |
| 37 | } |
| 38 | |
| 39 | public function jsonserialize() { |
| 40 | return [ |
| 41 | 'type' => $this->getType(), |
| 42 | 'name' => $this->getName(), |
| 43 | 'required' => $this->isRequired(), |
| 44 | 'readOnly' => $this->isReadOnly(), |
| 45 | 'options' => $this->getOptions(), |
| 46 | ]; |
| 47 | } |
| 48 | } |
| 49 |