Forráskód Böngészése

[FrameworkBundle][Form] Fix rendering search inputs in PHP

Victor Berchet 14 éve
szülő
commit
61721e3fd4

+ 1 - 1
src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php

@@ -1,6 +1,6 @@
 <input type="search"
     <?php echo $view['form']->attributes() ?>
-    name="<?php echo $view->escape($name) ?>"
+    name="<?php echo $view->escape($full_name) ?>"
     value="<?php echo $view->escape($value) ?>"
     <?php if ($read_only): ?>disabled="disabled"<?php endif ?>
     <?php if ($required): ?>required="required"<?php endif ?>

+ 21 - 0
tests/Symfony/Tests/Component/Form/AbstractDivLayoutTest.php

@@ -365,6 +365,27 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
             ]
     ]
     [count(.//input)=2]
+'
+        );
+    }
+
+    public function testSearchInputName()
+    {
+        $form = $this->factory->createNamedBuilder('form', 'full')
+            ->add('name', 'search')
+            ->getForm();
+
+        $this->assertWidgetMatchesXpath($form->createView(), array(),
+'/div
+    [
+        ./input[@type="hidden"][@id="full__token"]
+        /following-sibling::div
+            [
+                ./label[@for="full_name"]
+                /following-sibling::input[@type="search"][@id="full_name"][@name="full[name]"]
+            ]
+    ]
+    [count(//input)=2]
 '
         );
     }