[FORM] Fix bug where options were passed in the data parameter

This commit is contained in:
Hugo Sales 2021-08-16 18:43:36 +01:00
parent 1419035076
commit ebee70621b
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -85,10 +85,10 @@ abstract class Form
?object $target = null,
array $extra_data = [],
string $type = 'Symfony\Component\Form\Extension\Core\Type\FormType',
array $builder_options = []): SymfForm
array $form_options = []): SymfForm
{
$name = $form[array_key_last($form)][0];
$fb = self::$form_factory->createNamedBuilder($name, $type, array_merge($builder_options, ['translation_domain' => false]));
$fb = self::$form_factory->createNamedBuilder($name, $type, data: null, options: array_merge($form_options, ['translation_domain' => false]));
foreach ($form as [$key, $class, $options]) {
if ($target != null && empty($options['data']) && (strstr($key, 'password') == false) && $class != SubmitType::class) {
if (isset($extra_data[$key])) {