| 1 | <?php |
||
| 7 | abstract class Field |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The form of field. |
||
| 11 | * |
||
| 12 | * @var Form |
||
| 13 | */ |
||
| 14 | protected $form; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The name of field. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $name; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The template of field. |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $template = 'fields.input'; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * The rules of field. |
||
| 32 | * |
||
| 33 | * @var array |
||
| 34 | */ |
||
| 35 | protected $rules; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Get the name of field. |
||
| 39 | * |
||
| 40 | * @return string |
||
| 41 | */ |
||
| 42 | public function getName(): string |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Get the template of field. |
||
| 49 | * |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | public function getTemplate(): string |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Get the label of field. |
||
| 59 | * |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | public function getLabel(): string |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Get the placeholder of field. |
||
| 69 | * |
||
| 70 | * @return null|string |
||
| 71 | */ |
||
| 72 | public function getPlaceholder() |
||
| 76 | |||
| 77 | /** |
||
| 78 | * Get the text of field. |
||
| 79 | * |
||
| 80 | * @return null|string |
||
| 81 | */ |
||
| 82 | public function getText() |
||
| 86 | |||
| 87 | /** |
||
| 88 | * Set the name of field. |
||
| 89 | * |
||
| 90 | * @param string $name |
||
| 91 | */ |
||
| 92 | public function setName(string $name) |
||
| 96 | |||
| 97 | /** |
||
| 98 | * Set the rules of field. |
||
| 99 | * |
||
| 100 | * @param array $rules |
||
| 101 | */ |
||
| 102 | public function setRules(array $rules) |
||
| 106 | |||
| 107 | /** |
||
| 108 | * Set the form of field. |
||
| 109 | * |
||
| 110 | * @param Form $form |
||
| 111 | */ |
||
| 112 | public function setForm(Form $form) |
||
| 116 | } |