1 | <?php namespace Propaganistas\LaravelTranslatableBootForms\Form; |
||
6 | class FormBuilder extends _FormBuilder |
||
7 | { |
||
8 | |||
9 | /** |
||
10 | * Array of locale keys. |
||
11 | * |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $locales; |
||
15 | |||
16 | /** |
||
17 | * Since $model is a private property in the parent class, we need to define the model in this child class as well. |
||
18 | * {@inheritdoc} |
||
19 | */ |
||
20 | protected $model; |
||
21 | |||
22 | /** |
||
23 | * Sets the available locales for translatable fields. |
||
24 | * |
||
25 | * @param array $locales |
||
26 | */ |
||
27 | public function setLocales(array $locales) |
||
31 | |||
32 | /** |
||
33 | * Since $model is a private property in the parent class, we need to bind the model in this child class as well. |
||
34 | * {@inheritdoc} |
||
35 | * |
||
36 | */ |
||
37 | public function bind($model) |
||
42 | |||
43 | /** |
||
44 | * Since $model is a private property in the parent class, we need to unbind the model in this child class as well. |
||
45 | * {@inheritdoc} |
||
46 | * |
||
47 | */ |
||
48 | protected function unbindModel() |
||
49 | { |
||
50 | $this->model = null; |
||
51 | parent::unbindModel(); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Getting value from Model or ModelTranslation to populate form. |
||
56 | * Courtesy of TypiCMS/TranslatableBootForms (https://github.com/TypiCMS/TranslatableBootForms/blob/master/src/TranslatableFormBuilder.php) |
||
57 | * |
||
58 | * @param string $name key |
||
59 | * @return string value |
||
60 | */ |
||
61 | protected function getModelValue($name) |
||
75 | |||
76 | /** |
||
77 | * Create a label. |
||
78 | * |
||
79 | * @param string $label |
||
80 | * @return \AdamWathan\Form\Elements\Label |
||
81 | */ |
||
82 | public function label($label) |
||
93 | } |