Ojs\AdminBundle\Form\Type\UserType::buildForm PHP Method

buildForm() public method

public buildForm ( Symfony\Component\Form\FormBuilderInterface $builder, array $options )
$builder Symfony\Component\Form\FormBuilderInterface
$options array
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('username', 'text', ['label' => 'username', 'attr' => ['class' => 'validate[required]']])->add('password', 'password', ['label' => 'password', 'attr' => ['class' => 'validate[minSize[6]]']])->add('email', 'email', ['label' => 'email', 'attr' => ['class' => 'validate[required,custom[email]]']])->add('about')->add('title', null, ['required' => false, 'label' => 'user.title'])->add('firstName', 'text', ['label' => 'firstname', 'attr' => ['class' => 'validate[required]']])->add('lastName', 'text', ['label' => 'lastname', 'attr' => ['class' => 'validate[required]']])->add('enabled', 'checkbox', ['label' => 'user.isActive', 'required' => false])->add('subjects', 'entity', array('label' => 'subjects', 'class' => 'Ojs\\JournalBundle\\Entity\\Subject', 'property' => 'subject', 'multiple' => true, 'expanded' => false, 'attr' => array('class' => 'select2-element', 'style' => 'width:100%'), 'required' => false))->add('tags', 'tags')->add('avatar', 'jb_crop_image_ajax', array('required' => false, 'endpoint' => 'user', 'img_width' => 200, 'img_height' => 200, 'crop_options' => array('aspect-ratio' => 200 / 200, 'maxSize' => "[200, 200]")))->add('country', 'entity', array('class' => 'BulutYazilim\\LocationBundle\\Entity\\Country', 'required' => false, 'label' => 'Country', 'empty_value' => 'Select Country', 'attr' => array('class' => 'select2-element')));
    }

Usage Example

Example #1
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->remove('password');
 }