From 8819db3923e9a2ea8b73b3d0eafcedc4ab899c6b Mon Sep 17 00:00:00 2001 From: helmer Date: Thu, 16 Jun 2011 04:37:01 -0700 Subject: [PATCH] [Form] Allow setting different options to repeating fields --- .../Form/Extension/Core/Type/RepeatedType.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php b/src/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php index 1d65953d6804..c845047ef533 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php @@ -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']) + ; } @@ -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, ); }