[Form] Fixed TimeType not to render a "size" attribute in select tags
This commit is contained in:
parent
0fb397ccfb
commit
b7bd630652
@ -147,8 +147,9 @@
|
|||||||
{% if widget == 'single_text' %}
|
{% if widget == 'single_text' %}
|
||||||
{{ block('form_widget_simple') }}
|
{{ block('form_widget_simple') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} %}
|
||||||
<div {{ block('widget_container_attributes') }}>
|
<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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
<?php if ($widget == 'single_text'): ?>
|
<?php if ($widget == 'single_text'): ?>
|
||||||
<?php echo $view['form']->block($form, 'form_widget_simple'); ?>
|
<?php echo $view['form']->block($form, 'form_widget_simple'); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
<?php $vars = $widget == 'text' ? array('attr' => array('size' => 1)) : array() ?>
|
||||||
<div <?php echo $view['form']->block($form, 'widget_container_attributes') ?>>
|
<div <?php echo $view['form']->block($form, 'widget_container_attributes') ?>>
|
||||||
<?php
|
<?php
|
||||||
// There should be no spaces between the colons and the widgets, that's why
|
// There should be no spaces between the colons and the widgets, that's why
|
||||||
// this block is written in a single PHP tag
|
// 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 ':';
|
||||||
echo $view['form']->widget($form['minute'], array('attr' => array('size' => 1)));
|
echo $view['form']->widget($form['minute'], $vars);
|
||||||
|
|
||||||
if ($with_seconds) {
|
if ($with_seconds) {
|
||||||
echo ':';
|
echo ':';
|
||||||
echo $view['form']->widget($form['second'], array('attr' => array('size' => 1)));
|
echo $view['form']->widget($form['second'], $vars);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1531,11 +1531,11 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_hour"]
|
[@id="name_hour"]
|
||||||
[@size="1"]
|
[not(@size)]
|
||||||
[./option[@value="4"][@selected="selected"]]
|
[./option[@value="4"][@selected="selected"]]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_minute"]
|
[@id="name_minute"]
|
||||||
[@size="1"]
|
[not(@size)]
|
||||||
[./option[@value="5"][@selected="selected"]]
|
[./option[@value="5"][@selected="selected"]]
|
||||||
]
|
]
|
||||||
[count(./select)=2]
|
[count(./select)=2]
|
||||||
@ -1555,17 +1555,17 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_hour"]
|
[@id="name_hour"]
|
||||||
[@size="1"]
|
[not(@size)]
|
||||||
[./option[@value="4"][@selected="selected"]]
|
[./option[@value="4"][@selected="selected"]]
|
||||||
[count(./option)>23]
|
[count(./option)>23]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_minute"]
|
[@id="name_minute"]
|
||||||
[@size="1"]
|
[not(@size)]
|
||||||
[./option[@value="5"][@selected="selected"]]
|
[./option[@value="5"][@selected="selected"]]
|
||||||
[count(./option)>59]
|
[count(./option)>59]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_second"]
|
[@id="name_second"]
|
||||||
[@size="1"]
|
[not(@size)]
|
||||||
[./option[@value="6"][@selected="selected"]]
|
[./option[@value="6"][@selected="selected"]]
|
||||||
[count(./option)>59]
|
[count(./option)>59]
|
||||||
]
|
]
|
||||||
@ -1616,6 +1616,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
[@type="time"]
|
[@type="time"]
|
||||||
[@name="name"]
|
[@name="name"]
|
||||||
[@value="04:05"]
|
[@value="04:05"]
|
||||||
|
[not(@size)]
|
||||||
'
|
'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user