| 1 | <?php |
||
| 7 | abstract class Field |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The name of field. |
||
| 11 | * |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | protected $name; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The label of field. |
||
| 18 | * |
||
| 19 | * @var |
||
| 20 | */ |
||
| 21 | protected $label; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The type of field. |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $type = 'text'; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * The template of field. |
||
| 32 | * |
||
| 33 | * @var string |
||
| 34 | */ |
||
| 35 | protected $template; |
||
| 36 | /** |
||
| 37 | * translator of Field |
||
| 38 | * |
||
| 39 | * @var Translator |
||
| 40 | */ |
||
| 41 | private $translator; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Field constructor. |
||
| 45 | * |
||
| 46 | * @param Translator $translator |
||
| 47 | */ |
||
| 48 | public function __construct(Translator $translator) |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Get the name of field. |
||
| 55 | * |
||
| 56 | * @return string |
||
| 57 | */ |
||
| 58 | public function getName(): string |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Get the label of field. |
||
| 65 | * |
||
| 66 | * @return string |
||
| 67 | */ |
||
| 68 | public function getLabel(): string |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Get the type of field. |
||
| 77 | * |
||
| 78 | * @return string |
||
| 79 | */ |
||
| 80 | public function getType(): string |
||
| 84 | |||
| 85 | /** |
||
| 86 | * Get the template of field. |
||
| 87 | * |
||
| 88 | * @return string |
||
| 89 | */ |
||
| 90 | public function getTemplate(): string |
||
| 94 | |||
| 95 | /** |
||
| 96 | * Set the name of field. |
||
| 97 | * |
||
| 98 | * @param string $name |
||
| 99 | */ |
||
| 100 | public function setName(string $name) |
||
| 104 | |||
| 105 | /** |
||
| 106 | * Set the type of field. |
||
| 107 | * |
||
| 108 | * @param string $type |
||
| 109 | */ |
||
| 110 | public function setType(string $type) |
||
| 114 | } |