merged branch bschussek/issue6153 (PR #7155)
This PR was merged into the 2.1 branch.
Commits
-------
b7bd630
[Form] Fixed TimeType not to render a "size" attribute in select tags
Discussion
----------
[Form] Fixed TimeType not to render a "size" attribute in select tags
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #6153
| License | MIT
| Doc PR | -
This commit is contained in:
commit
205021b5b3
@ -147,8 +147,9 @@
|
||||
{% if widget == 'single_text' %}
|
||||
{{ block('form_widget_simple') }}
|
||||
{% else %}
|
||||
{% set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} %}
|
||||
<div {{ block('widget_container_attributes') }}>
|
||||
{{ form_widget(form.hour, { 'attr': { 'size': '1' } }) }}:{{ form_widget(form.minute, { 'attr': { 'size': '1' } }) }}{% if with_seconds %}:{{ form_widget(form.second, { 'attr': { 'size': '1' } }) }}{% endif %}
|
||||
{{ form_widget(form.hour, vars) }}:{{ form_widget(form.minute, vars) }}{% if with_seconds %}:{{ form_widget(form.second, vars) }}{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endspaceless %}
|
||||
|
@ -1,17 +1,18 @@
|
||||
<?php if ($widget == 'single_text'): ?>
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple'); ?>
|
||||
<?php else: ?>
|
||||
<?php $vars = $widget == 'text' ? array('attr' => array('size' => 1)) : array() ?>
|
||||
<div <?php echo $view['form']->block($form, 'widget_container_attributes') ?>>
|
||||
<?php
|
||||
// There should be no spaces between the colons and the widgets, that's why
|
||||
// this block is written in a single PHP tag
|
||||
echo $view['form']->widget($form['hour'], array('attr' => array('size' => 1)));
|
||||
echo $view['form']->widget($form['hour'], $vars);
|
||||
echo ':';
|
||||
echo $view['form']->widget($form['minute'], array('attr' => array('size' => 1)));
|
||||
echo $view['form']->widget($form['minute'], $vars);
|
||||
|
||||
if ($with_seconds) {
|
||||
echo ':';
|
||||
echo $view['form']->widget($form['second'], array('attr' => array('size' => 1)));
|
||||
echo $view['form']->widget($form['second'], $vars);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -1531,11 +1531,11 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
||||
[
|
||||
./select
|
||||
[@id="name_hour"]
|
||||
[@size="1"]
|
||||
[not(@size)]
|
||||
[./option[@value="4"][@selected="selected"]]
|
||||
/following-sibling::select
|
||||
[@id="name_minute"]
|
||||
[@size="1"]
|
||||
[not(@size)]
|
||||
[./option[@value="5"][@selected="selected"]]
|
||||
]
|
||||
[count(./select)=2]
|
||||
@ -1555,17 +1555,17 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
||||
[
|
||||
./select
|
||||
[@id="name_hour"]
|
||||
[@size="1"]
|
||||
[not(@size)]
|
||||
[./option[@value="4"][@selected="selected"]]
|
||||
[count(./option)>23]
|
||||
/following-sibling::select
|
||||
[@id="name_minute"]
|
||||
[@size="1"]
|
||||
[not(@size)]
|
||||
[./option[@value="5"][@selected="selected"]]
|
||||
[count(./option)>59]
|
||||
/following-sibling::select
|
||||
[@id="name_second"]
|
||||
[@size="1"]
|
||||
[not(@size)]
|
||||
[./option[@value="6"][@selected="selected"]]
|
||||
[count(./option)>59]
|
||||
]
|
||||
@ -1616,6 +1616,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
||||
[@type="time"]
|
||||
[@name="name"]
|
||||
[@value="04:05"]
|
||||
[not(@size)]
|
||||
'
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user