Skip to content

Commit

Permalink
[Form] Allow setting different options to repeating fields
Browse files Browse the repository at this point in the history
  • Loading branch information
helmer authored and root committed Sep 24, 2011
1 parent 18d3dfe commit 8819db3
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php
Expand Up @@ -27,8 +27,9 @@ public function buildForm(FormBuilder $builder, array $options)
$options['first_name'],
$options['second_name'],
)))
->add($options['first_name'], $options['type'], $options['options'])
->add($options['second_name'], $options['type'], $options['options'])
->add($options['first_name'], $options['type'], 0 < count($options['first_options']) ? $options['first_options'] : $options['options'])
->add($options['second_name'], $options['type'], 0 < count($options['second_options']) ? $options['second_options'] : $options['options'])

;
}

Expand All @@ -38,11 +39,13 @@ public function buildForm(FormBuilder $builder, array $options)
public function getDefaultOptions(array $options)
{
return array(
'type' => 'text',
'options' => array(),
'first_name' => 'first',
'second_name' => 'second',
'error_bubbling' => false,
'type' => 'text',
'options' => array(),
'first_options' => array(),
'second_options' => array(),
'first_name' => 'first',
'second_name' => 'second',
'error_bubbling' => false,
);
}

Expand Down

0 comments on commit 8819db3

Please sign in to comment.