Merge branch '2.3' into 2.6

Conflicts:
	src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
	src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_collapsed.html.php
This commit is contained in:
Tobias Schultze 2015-06-27 22:15:38 +02:00
commit cbca187a49
7 changed files with 19 additions and 20 deletions

View File

@ -57,7 +57,7 @@
{%- endif -%} {%- endif -%}
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}> <select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
{%- if placeholder is not none -%} {%- if placeholder is not none -%}
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder|trans({}, translation_domain) }}</option> <option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder != '' ? placeholder|trans({}, translation_domain) }}</option>
{%- endif -%} {%- endif -%}
{%- if preferred_choices|length > 0 -%} {%- if preferred_choices|length > 0 -%}
{% set options = preferred_choices %} {% set options = preferred_choices %}

View File

@ -7,7 +7,7 @@
)) ?> )) ?>
<?php if ($multiple): ?> multiple="multiple"<?php endif ?> <?php if ($multiple): ?> multiple="multiple"<?php endif ?>
> >
<?php if (null !== $placeholder): ?><option value=""<?php if ($required and empty($value) && "0" !== $value): ?> selected="selected"<?php endif?>><?php echo $view->escape($view['translator']->trans($placeholder, array(), $translation_domain)) ?></option><?php endif; ?> <?php if (null !== $placeholder): ?><option value=""<?php if ($required and empty($value) && '0' !== $value): ?> selected="selected"<?php endif?>><?php echo '' != $placeholder ? $view->escape($view['translator']->trans($placeholder, array(), $translation_domain)) : '' ?></option><?php endif; ?>
<?php if (count($preferred_choices) > 0): ?> <?php if (count($preferred_choices) > 0): ?>
<?php echo $view['form']->block($form, 'choice_widget_options', array('choices' => $preferred_choices)) ?> <?php echo $view['form']->block($form, 'choice_widget_options', array('choices' => $preferred_choices)) ?>
<?php if (count($choices) > 0 && null !== $separator): ?> <?php if (count($choices) > 0 && null !== $separator): ?>

View File

@ -107,7 +107,7 @@ class ResizeFormListener implements EventSubscriberInterface
} }
if (!is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) { if (!is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) {
throw new UnexpectedTypeException($data, 'array or (\Traversable and \ArrayAccess)'); $data = array();
} }
// Remove all empty rows // Remove all empty rows

View File

@ -334,7 +334,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
[@class="my&class form-control"] [@class="my&class form-control"]
[not(@required)] [not(@required)]
[ [
./option[@value=""][.="[trans][/trans]"] ./option[@value=""][.=""]
/following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"] /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
/following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"] /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
] ]
@ -358,7 +358,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
[@class="my&class form-control"] [@class="my&class form-control"]
[not(@required)] [not(@required)]
[ [
./option[@value=""][.="[trans][/trans]"] ./option[@value=""][.=""]
/following-sibling::option[@value="&a"][not(@selected)][.="[trans]Choice&A[/trans]"] /following-sibling::option[@value="&a"][not(@selected)][.="[trans]Choice&A[/trans]"]
/following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"] /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
] ]
@ -432,7 +432,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
[@class="my&class form-control"] [@class="my&class form-control"]
[@required="required"] [@required="required"]
[ [
./option[@value=""][not(@selected)][not(@disabled)][.="[trans][/trans]"] ./option[@value=""][not(@selected)][not(@disabled)][.=""]
/following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"] /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
/following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"] /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
] ]
@ -1140,17 +1140,17 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
./select ./select
[@id="name_month"] [@id="name_month"]
[@class="form-control"] [@class="form-control"]
[./option[@value=""][not(@selected)][not(@disabled)][.="[trans][/trans]"]] [./option[@value=""][not(@selected)][not(@disabled)][.=""]]
[./option[@value="1"][@selected="selected"]] [./option[@value="1"][@selected="selected"]]
/following-sibling::select /following-sibling::select
[@id="name_day"] [@id="name_day"]
[@class="form-control"] [@class="form-control"]
[./option[@value=""][not(@selected)][not(@disabled)][.="[trans][/trans]"]] [./option[@value=""][not(@selected)][not(@disabled)][.=""]]
[./option[@value="1"][@selected="selected"]] [./option[@value="1"][@selected="selected"]]
/following-sibling::select /following-sibling::select
[@id="name_year"] [@id="name_year"]
[@class="form-control"] [@class="form-control"]
[./option[@value=""][not(@selected)][not(@disabled)][.="[trans][/trans]"]] [./option[@value=""][not(@selected)][not(@disabled)][.=""]]
[./option[@value="1950"][@selected="selected"]] [./option[@value="1950"][@selected="selected"]]
] ]
[count(./select)=3] [count(./select)=3]

View File

@ -614,7 +614,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
[@name="name"] [@name="name"]
[not(@required)] [not(@required)]
[ [
./option[@value=""][.="[trans][/trans]"] ./option[@value=""][.=""]
/following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"] /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
/following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"] /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
] ]
@ -637,7 +637,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
[@name="name"] [@name="name"]
[not(@required)] [not(@required)]
[ [
./option[@value=""][.="[trans][/trans]"] ./option[@value=""][.=""]
/following-sibling::option[@value="&a"][not(@selected)][.="[trans]Choice&A[/trans]"] /following-sibling::option[@value="&a"][not(@selected)][.="[trans]Choice&A[/trans]"]
/following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"] /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
] ]
@ -714,7 +714,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
[@name="name"] [@name="name"]
[@required="required"] [@required="required"]
[ [
./option[@value=""][not(@selected)][not(@disabled)][.="[trans][/trans]"] ./option[@value=""][not(@selected)][not(@disabled)][.=""]
/following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"] /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
/following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"] /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
] ]
@ -1342,15 +1342,15 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
[ [
./select ./select
[@id="name_month"] [@id="name_month"]
[./option[@value=""][not(@selected)][not(@disabled)][.="[trans][/trans]"]] [./option[@value=""][not(@selected)][not(@disabled)][.=""]]
[./option[@value="1"][@selected="selected"]] [./option[@value="1"][@selected="selected"]]
/following-sibling::select /following-sibling::select
[@id="name_day"] [@id="name_day"]
[./option[@value=""][not(@selected)][not(@disabled)][.="[trans][/trans]"]] [./option[@value=""][not(@selected)][not(@disabled)][.=""]]
[./option[@value="1"][@selected="selected"]] [./option[@value="1"][@selected="selected"]]
/following-sibling::select /following-sibling::select
[@id="name_year"] [@id="name_year"]
[./option[@value=""][not(@selected)][not(@disabled)][.="[trans][/trans]"]] [./option[@value=""][not(@selected)][not(@disabled)][.=""]]
[./option[@value="1950"][@selected="selected"]] [./option[@value="1950"][@selected="selected"]]
] ]
[count(./select)=3] [count(./select)=3]

View File

@ -167,15 +167,14 @@ class ResizeFormListenerTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($this->form->has('2')); $this->assertFalse($this->form->has('2'));
} }
/** public function testPreSubmitDealsWithNoArrayOrTraversable()
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
*/
public function testPreSubmitRequiresArrayOrTraversable()
{ {
$data = 'no array or traversable'; $data = 'no array or traversable';
$event = new FormEvent($this->form, $data); $event = new FormEvent($this->form, $data);
$listener = new ResizeFormListener('text', array(), false, false); $listener = new ResizeFormListener('text', array(), false, false);
$listener->preSubmit($event); $listener->preSubmit($event);
$this->assertFalse($this->form->has('1'));
} }
public function testPreSubmitDealsWithNullData() public function testPreSubmitDealsWithNullData()

View File

@ -40,7 +40,7 @@
</trans-unit> </trans-unit>
<trans-unit id="10"> <trans-unit id="10">
<source>This field is missing.</source> <source>This field is missing.</source>
<target>Questo campo è manca.</target> <target>Questo campo è mancante.</target>
</trans-unit> </trans-unit>
<trans-unit id="11"> <trans-unit id="11">
<source>This value is not a valid date.</source> <source>This value is not a valid date.</source>