public function configureOptions(FieldOptionsResolver $options)
 {
     $options->setFormMapper(function ($options, $shared) {
         $options['input'] = 'datetime';
         return $options;
     });
 }
示例#2
0
 public function configureOptions(FieldOptionsResolver $options)
 {
     $options->setFormMapper(function ($options, $shared) {
         $options['input'] = 'datetime';
         return $options;
     });
     $options->setViewMapper(function ($options, $shared) {
         $options = array_merge(['time_format' => 'none'], $options);
         return $options;
     });
 }
 public function configureOptions(FieldOptionsResolver $options)
 {
     $options->setRequired(['field_type']);
     $options->setDefault('field_options', []);
     $options->setFormMapper(function (array $options, array $shared) {
         // default to allowing add / delete (contrary to the form types
         // default behavior).
         $options = array_merge(['allow_add' => true, 'allow_delete' => true], $options);
         // resolve the form options for the colletion entry.
         $field = $this->registry->get($shared['field_type']);
         $resolver = new FieldOptionsResolver();
         $field->configureOptions($resolver);
         $entryOptions = $resolver->resolveFormOptions(FieldOptions::create($shared['field_options']));
         // do not allow entry_type or entry_options to be overridden.
         $options['entry_type'] = $field->getFormType();
         $options['entry_options'] = $entryOptions;
         return $options;
     });
     $options->setViewMapper(function ($options, $shared) {
         return array_merge($options, ['field_type' => $shared['field_type'], 'field_options' => $shared['field_options']]);
     });
 }