Procházet zdrojové kódy

fixed default options

Pat Haggerty před 13 roky
rodič
revize
99bac95bc5

+ 3 - 5
Form/Type/Filter/DateRangeType.php

@@ -52,17 +52,15 @@ class DateRangeType extends AbstractType
         
         
         $builder
         $builder
             ->add('type', 'choice', array('choices' => $choices, 'required' => false))
             ->add('type', 'choice', array('choices' => $choices, 'required' => false))
-            ->add('value', 'sonata_type_date_range', array('field_options' => array_merge(array('format' => 'yyyy-MM-dd'), $options['field_options'])))
+            ->add('value', 'sonata_type_date_range', array('field_options' => $options['field_options']))
         ;
         ;
     }
     }
 
 
     public function getDefaultOptions(array $options)
     public function getDefaultOptions(array $options)
     {
     {
         $defaultOptions = array(
         $defaultOptions = array(
-            'operator_type'    => 'hidden',
-            'operator_options' => array(),
-            'field_type'       => 'text',
-            'field_options'    => array()
+            'field_type'       => 'sonata_type_date_range',
+            'field_options'    => array('format' => 'yyyy-MM-dd')
         );
         );
 
 
         $options = array_replace($options, $defaultOptions);
         $options = array_replace($options, $defaultOptions);

+ 3 - 5
Form/Type/Filter/DateTimeRangeType.php

@@ -52,17 +52,15 @@ class DateTimeRangeType extends AbstractType
         
         
         $builder
         $builder
             ->add('type', 'choice', array('choices' => $choices, 'required' => false))
             ->add('type', 'choice', array('choices' => $choices, 'required' => false))
-            ->add('value', 'sonata_type_datetime_range', array('field_options' => array_merge(array('date_format' => 'yyyy-MM-dd'), $options['field_options'])))
+            ->add('value', 'sonata_type_datetime_range', array('field_options' => $options['field_options']))
         ;
         ;
     }
     }
 
 
     public function getDefaultOptions(array $options)
     public function getDefaultOptions(array $options)
     {
     {
         $defaultOptions = array(
         $defaultOptions = array(
-            'operator_type'    => 'hidden',
-            'operator_options' => array(),
-            'field_type'       => 'text',
-            'field_options'    => array(),
+            'field_type'       => 'sonata_type_datetime_range',
+            'field_options'    => array('date_format' => 'yyyy-MM-dd'),
         );
         );
 
 
         $options = array_replace($options, $defaultOptions);
         $options = array_replace($options, $defaultOptions);

+ 3 - 5
Form/Type/Filter/DateTimeType.php

@@ -69,17 +69,15 @@ class DateTimeType extends AbstractType
 
 
         $builder
         $builder
             ->add('type', 'choice', array('choices' => $choices, 'required' => false))
             ->add('type', 'choice', array('choices' => $choices, 'required' => false))
-            ->add('value', 'datetime', array_merge(array('required' => false, 'date_format' => 'yyyy-MM-dd'), $options['field_options']))
+            ->add('value', 'datetime', array_merge(array('required' => false), $options['field_options']))
         ;
         ;
     }
     }
 
 
     public function getDefaultOptions(array $options)
     public function getDefaultOptions(array $options)
     {
     {
         $defaultOptions = array(
         $defaultOptions = array(
-            'operator_type'    => 'hidden',
-            'operator_options' => array(),
-            'field_type'       => 'text',
-            'field_options'    => array()
+            'field_type'       => 'datetime',
+            'field_options'    => array('date_format' => 'yyyy-MM-dd')
         );
         );
 
 
         $options = array_replace($options, $defaultOptions);
         $options = array_replace($options, $defaultOptions);

+ 3 - 5
Form/Type/Filter/DateType.php

@@ -69,17 +69,15 @@ class DateType extends AbstractType
 
 
         $builder
         $builder
             ->add('type', 'choice', array('choices' => $choices, 'required' => false))
             ->add('type', 'choice', array('choices' => $choices, 'required' => false))
-            ->add('value', 'date', array_merge(array('required' => false, 'format' => 'yyyy-MM-dd'), $options['field_options']))
+            ->add('value', 'date', array_merge(array('required' => false), $options['field_options']))
         ;
         ;
     }
     }
 
 
     public function getDefaultOptions(array $options)
     public function getDefaultOptions(array $options)
     {
     {
         $defaultOptions = array(
         $defaultOptions = array(
-            'operator_type'    => 'hidden',
-            'operator_options' => array(),
-            'field_type'       => 'text',
-            'field_options'    => array()
+            'field_type'       => 'date',
+            'field_options'    => array('date_format' => 'yyyy-MM-dd')
         );
         );
 
 
         $options = array_replace($options, $defaultOptions);
         $options = array_replace($options, $defaultOptions);