DateType single-text should be single_text

This commit is contained in:
Miha Vrhovnik 2011-05-27 16:23:59 +02:00
parent af2f9207be
commit b8144c62ad
6 changed files with 25 additions and 25 deletions

View File

@ -1,4 +1,4 @@
<?php if ($widget == 'single-text'): ?>
<?php if ($widget == 'single_text'): ?>
<input type="text"
<?php echo $view['form']->attributes() ?>
name="<?php echo $view->escape($full_name) ?>"

View File

@ -158,7 +158,7 @@
{% block date_widget %}
{% spaceless %}
{% if widget == 'single-text' %}
{% if widget == 'single_text' %}
{{ block('text_widget') }}
{% else %}
<div {{ block('container_attributes') }}>

View File

@ -123,7 +123,7 @@ class DateTimeType extends AbstractType
),
'date_widget' => array(
null, // inherit default from DateType
'single-text',
'single_text',
'text',
'choice',
),

View File

@ -34,7 +34,7 @@ class DateType extends AbstractType
\DateTimeZone::UTC
);
if ($options['widget'] === 'single-text') {
if ($options['widget'] === 'single_text') {
$builder->appendClientTransformer(new DateTimeToLocalizedStringTransformer($options['data_timezone'], $options['user_timezone'], $options['format'], \IntlDateFormatter::NONE));
} else {
$yearOptions = $monthOptions = $dayOptions = array();
@ -135,7 +135,7 @@ class DateType extends AbstractType
'array',
),
'widget' => array(
'single-text',
'single_text',
'text',
'choice',
),
@ -150,7 +150,7 @@ class DateType extends AbstractType
public function getParent(array $options)
{
return $options['widget'] === 'single-text' ? 'field' : 'form';
return $options['widget'] === 'single_text' ? 'field' : 'form';
}
public function getName()

View File

@ -623,7 +623,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
$form = $this->factory->createNamed('date', 'na&me', '2011-02-03', array(
'property_path' => 'name',
'input' => 'string',
'widget' => 'single-text',
'widget' => 'single_text',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),

View File

@ -50,7 +50,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'input' => 'datetime',
));
@ -65,7 +65,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'input' => 'string',
));
@ -80,7 +80,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'input' => 'timestamp',
));
@ -97,7 +97,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'input' => 'array',
));
@ -185,7 +185,7 @@ class DateTypeTest extends LocalizedTestCase
'user_timezone' => 'Pacific/Tahiti',
// don't do this test with DateTime, because it leads to wrong results!
'input' => 'string',
'widget' => 'single-text',
'widget' => 'single_text',
));
$form->setData('2010-06-02');
@ -200,7 +200,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'years' => array(2010, 2011),
));
@ -216,7 +216,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'years' => array(2010, 2011),
));
@ -252,7 +252,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'years' => array(2010, 2012),
));
@ -268,7 +268,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'months' => array(6, 7),
));
@ -284,7 +284,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'months' => array(6, 7),
));
@ -320,7 +320,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'months' => array(6, 8),
));
@ -336,7 +336,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'days' => array(6, 7),
));
@ -352,7 +352,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'days' => array(6, 7),
));
@ -390,7 +390,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
'days' => array(6, 8),
));
@ -406,7 +406,7 @@ class DateTypeTest extends LocalizedTestCase
$form = $this->factory->create('date', null, array(
'data_timezone' => 'UTC',
'user_timezone' => 'UTC',
'widget' => 'single-text',
'widget' => 'single_text',
));
$form->bind('7.6.2010');
@ -482,7 +482,7 @@ class DateTypeTest extends LocalizedTestCase
public function testDontPassDatePatternIfText()
{
$form = $this->factory->create('date', null, array(
'widget' => 'single-text',
'widget' => 'single_text',
));
$view = $form->createView();
@ -492,10 +492,10 @@ class DateTypeTest extends LocalizedTestCase
public function testPassWidgetToView()
{
$form = $this->factory->create('date', null, array(
'widget' => 'single-text',
'widget' => 'single_text',
));
$view = $form->createView();
$this->assertSame('single-text', $view->get('widget'));
$this->assertSame('single_text', $view->get('widget'));
}
}