|
@@ -48,7 +48,7 @@ discard block |
|
|
block discarded – undo |
|
48
|
48
|
} |
|
49
|
49
|
|
|
50
|
50
|
// 'populate' fields by *hook on form generation |
|
51
|
|
- $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($fieldName, $locales, $translations, $fieldType, $class, $required, $className, $id) { |
|
|
51
|
+ $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) use ($fieldName, $locales, $translations, $fieldType, $class, $required, $className, $id) { |
|
52
|
52
|
$form = $event->getForm(); |
|
53
|
53
|
foreach ($locales as $locale) { |
|
54
|
54
|
$data = (array_key_exists($locale, $translations) && array_key_exists($fieldName, $translations[$locale])) ? $translations[$locale][$fieldName] : null; |
|
@@ -69,7 +69,7 @@ discard block |
|
|
block discarded – undo |
|
69
|
69
|
$form->add('currentFieldName', 'hidden', ['data' => $fieldName]); |
|
70
|
70
|
}); |
|
71
|
71
|
|
|
72
|
|
- $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($fieldName, $className, $id, $locales) { |
|
|
72
|
+ $builder->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) use ($fieldName, $className, $id, $locales) { |
|
73
|
73
|
$form = $event->getForm(); |
|
74
|
74
|
$this->manager->persistTranslations($form, $className, $fieldName, $id, $locales); |
|
75
|
75
|
}); |