Inheritance: extends Symfony\Component\Form\AbstractType
Beispiel #1
0
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     parent::setDefaultOptions($resolver);
     /*$resolver->setDefaults(array(
           'data_class' => 'NGS\ByteStream',
       ));*/
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $view->vars['filter'] = $options['filter'];
     $view->vars['object'] = $form->getParent()->getData();
     $view->vars['preview'] = $options['preview'];
 }
Beispiel #3
0
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $view->vars = array_replace($view->vars, array('type' => 'file', 'value' => ''));
     if (array_key_exists('file_path', $options)) {
         $parentData = $form->getParent()->getData();
         if (null !== $parentData) {
             $accessor = PropertyAccess::getPropertyAccessor();
             $imageUrl = $accessor->getValue($parentData, $options['file_path']);
             $value = $accessor->getValue($parentData, 'filePath');
         } else {
             $imageUrl = null;
             $value = null;
         }
         // set an "image_url" variable that will be available when rendering this field
         $view->vars['file_url'] = $imageUrl;
         $view->vars['value'] = $value;
     }
 }
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $view->vars = array_replace($view->vars, array('type' => 'file', 'value' => ''));
     if (array_key_exists('file_path', $options)) {
         $parentData = $form->getParent()->getData();
         if (!is_null($parentData)) {
             $accessor = PropertyAccess::getPropertyAccessor();
             $imageUrl = $accessor->getValue($parentData, $options['file_path']);
             $value = $accessor->getValue($parentData, 'filePath');
         } else {
             $imageUrl = null;
             $value = null;
         }
         $view->vars['file_url'] = $imageUrl;
         $view->vars['value'] = $value;
     }
     $view->vars['file_path'] = $options['show_path'];
 }
Beispiel #5
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->setAttribute('image', $options['image']);
 }
 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     parent::setDefaultOptions($resolver);
     $defaults = [];
     $defaults['uploadtype'] = 'file';
     $defaults['placeholdWidth'] = null;
     $defaults['placeholdHeight'] = null;
     $defaults['placeholdText'] = null;
     $defaults['ratio'] = null;
     $defaults['remove'] = false;
     $resolver->setDefaults($defaults);
 }