當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FormBuilderInterface::remove方法代碼示例

本文整理匯總了PHP中Symfony\Component\Form\FormBuilderInterface::remove方法的典型用法代碼示例。如果您正苦於以下問題:PHP FormBuilderInterface::remove方法的具體用法?PHP FormBuilderInterface::remove怎麽用?PHP FormBuilderInterface::remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Form\FormBuilderInterface的用法示例。


在下文中一共展示了FormBuilderInterface::remove方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: manageLinkTypeRelatedFields

 /**
  * Add the types related to the LinkType value.
  *
  * @param                                    $linkType
  * @param                                    $locale
  * @param FormBuilderInterface|FormInterface $form
  * @param FormBuilderInterface               $builder
  */
 protected function manageLinkTypeRelatedFields($linkType, $locale, $form, FormBuilderInterface $builder)
 {
     $form->remove('route');
     $form->remove('url');
     $form->remove('attachedWidget');
     $form->remove('viewReference');
     $form->remove('locale');
     switch ($linkType) {
         case Link::TYPE_VIEW_REFERENCE:
             $locale = $locale ?: $this->requestStack->getCurrentRequest()->getLocale();
             $form->add('viewReference', ChoiceType::class, ['label' => 'form.link_type.view_reference.label', 'required' => true, 'attr' => ['novalidate' => 'novalidate'], 'placeholder' => 'form.link_type.view_reference.blank', 'choices' => $this->viewReferenceRepository->getChoices($locale), 'choices_as_values' => true, 'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group']])->add('locale', ChoiceType::class, ['label' => 'form.link_type.locale.label', 'choices' => array_combine($this->availableLocales, $this->availableLocales), 'attr' => ['data-refreshOnChange' => 'true']]);
             break;
         case Link::TYPE_ROUTE:
             $form->add('route', null, ['label' => 'form.link_type.route.label', 'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'], 'required' => true, 'attr' => ['novalidate' => 'novalidate', 'placeholder' => 'form.link_type.route.placeholder']])->add('route_parameters', JsonType::class, ['label' => 'form.link_type.route_parameters.label', 'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'], 'required' => true, 'attr' => ['novalidate' => 'novalidate', 'placeholder' => 'form.link_type.route_parameters.placeholder']]);
             break;
         case Link::TYPE_URL:
             $form->add('url', null, ['label' => 'form.link_type.url.label', 'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'], 'required' => true, 'attr' => ['novalidate' => 'novalidate', 'placeholder' => 'form.link_type.url.placeholder']]);
             break;
         case Link::TYPE_WIDGET:
             $form->add('attachedWidget', EntityType::class, ['label' => 'form.link_type.attachedWidget.label', 'placeholder' => 'form.link_type.attachedWidget.blank', 'class' => 'VictoireWidgetBundle:Widget', 'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'], 'required' => true, 'attr' => ['novalidate' => 'novalidate']]);
             break;
         case Link::TYPE_NONE:
         case null:
             $form->remove('target');
             break;
     }
 }
開發者ID:victoire,項目名稱:victoire,代碼行數:35,代碼來源:LinkType.php

示例2: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->remove('plainPassword');
     $builder->remove('username');
     $builder->remove('email');
     $builder->add('firstName', null, ['label' => 'Voornaam']);
     $builder->add('lastName', null, ['label' => 'Achternaam']);
     $builder->add('email', EmailType::class, ['label' => 'Email']);
     $builder->add('phone', null, ['label' => 'Telefoon']);
 }
開發者ID:CoderDojoNederland,項目名稱:Website,代碼行數:10,代碼來源:ProfileFormType.php

示例3: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $dateOptions = $builder->get('date')->getOptions();
     $timeOptions = $builder->get('time')->getOptions();
     $builder->remove('date')->add('date', 'datepicker', $dateOptions);
     if (isset($options['preferred_choices'])) {
         $timeOptions = array_merge($timeOptions, array('hours' => $options['preferred_choices']['hours'], 'minutes' => $options['preferred_choices']['minutes']));
         $builder->remove('time')->add('time', 'time', $timeOptions);
     }
 }
開發者ID:NobletSolutions,項目名稱:UtilBundle,代碼行數:13,代碼來源:DateTimePicker.php

示例4: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     // add your custom field
     $builder->remove('username');
     $builder->remove('email');
     $builder->remove('plainPassword');
     $builder->add('firstName', null, ['label' => 'Voornaam', 'constraints' => [new NotBlank()]]);
     $builder->add('lastName', null, ['label' => 'Achternaam', 'constraints' => [new NotBlank()]]);
     $builder->add('phone', null, ['label' => 'Telefoon', 'constraints' => [new NotBlank(), new Length(["min" => 10, "max" => 10])]]);
     $builder->add('email', LegacyFormHelper::getType('Symfony\\Component\\Form\\Extension\\Core\\Type\\EmailType'), array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'));
     $builder->add('plainPassword', LegacyFormHelper::getType('Symfony\\Component\\Form\\Extension\\Core\\Type\\RepeatedType'), array('type' => LegacyFormHelper::getType('Symfony\\Component\\Form\\Extension\\Core\\Type\\PasswordType'), 'options' => array('translation_domain' => 'FOSUserBundle'), 'first_options' => array('label' => 'form.password'), 'second_options' => array('label' => 'form.password_confirmation'), 'invalid_message' => 'fos_user.password.mismatch'));
 }
開發者ID:CoderDojoNederland,項目名稱:Website,代碼行數:12,代碼來源:RegistrationFormType.php

示例5: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     // add your custom field
     $builder->add('city', null, array('label' => 'Miestas'));
     $builder->add('address', null, array('label' => 'Adresas'));
     $builder->add('phoneNumber', null, array('label' => 'Tel. nr'));
     $builder->add('profilePictureFile', null, array('label' => 'Nuotrauka'));
     $builder->add('description', TextareaType::class, array('label' => 'Aprašymas', 'attr' => array('cols' => '20', 'rows' => '5')));
     $builder->add('startTime', TimeType::class, array('label' => 'Darbo laiko pradžia', 'placeholder' => array('hour' => 'Valanda'), 'data' => new \DateTime('2015-09-09 08:00:00')));
     $builder->add('endTime', TimeType::class, array('label' => 'Darbo laiko pabaiga', 'placeholder' => array('hour' => 'Valanda'), 'data' => new \DateTime('2015-09-09 18:00:00')));
     $builder->remove('current_password');
     $builder->remove('username');
     //...............
     //Add all your properties here with $builder->add('property name')
 }
開發者ID:deileo,項目名稱:Autoservisas_Kursinis,代碼行數:15,代碼來源:ProfileType.php

示例6: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('enabled', BooleanType::class)->add('confirmed', BooleanType::class);
     if ($this->isOtherUser($builder->getData())) {
         $builder->remove('password');
     }
 }
開發者ID:Eraac,項目名稱:rest-project,代碼行數:10,代碼來源:UserEditAdminType.php

示例7: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $id = $builder->getData()->getId();
     $builder->remove('metaId')->add('defaultBranch', 'entity', array('class' => 'HLPNebulaBundle:Branch', 'expanded' => false, 'multiple' => false, 'mapped' => false, 'query_builder' => function (\HLP\NebulaBundle\Entity\BranchRepository $repo) use($id) {
         return $repo->getBranchQueryBuilder($id);
     }));
 }
開發者ID:ngld,項目名稱:hlp-nebula,代碼行數:7,代碼來源:MetaEditType.php

示例8: remove

 /**
  * {@inheritdoc}
  */
 public function remove($key)
 {
     $this->admin->removeFormFieldDescription($key);
     $this->admin->removeFieldFromFormGroup($key);
     $this->formBuilder->remove($key);
     return $this;
 }
開發者ID:nagyistoce,項目名稱:SonataAdminBundle,代碼行數:10,代碼來源:FormMapper.php

示例9: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('type', 'choice', array('label' => 'I am a', 'choices' => array(User::ROLE_STUDENT => 'Student', User::ROLE_GS1_MEMBER => 'Member'), 'data' => 'student', 'attr' => array('class' => 'account_type')))->add('firstName', null, array('attr' => array('maxlength' => false), 'render_required_asterisk' => true))->add('lastName', null, array('attr' => array('maxlength' => false), 'render_required_asterisk' => true))->add('email', 'email', array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle', 'render_required_asterisk' => true))->add('plainPassword', 'repeated', array('type' => 'password', 'options' => array('translation_domain' => 'FOSUserBundle'), 'first_options' => array('label' => 'form.password', 'render_required_asterisk' => true), 'second_options' => array('label' => 'form.password_confirmation', 'render_required_asterisk' => true), 'invalid_message' => 'fos_user.password.mismatch'))->add('toc', 'checkbox', array('mapped' => false, 'label' => 'I agree to <a id="toc" href="#">terms & conditions</a>', 'constraints' => array(new IsTrue(array('message' => 'You must agree to terms & conditions')))))->add('studentProfile', new StudentRegistrationType($this->entityManager), array('label' => false, 'widget_form_group' => false, 'widget_type' => 'inline'));
     $builder->get('email')->setAttribute('render_required_asterisk', true);
     $builder->get('plainPassword')->setAttribute('render_required_asterisk', true);
     $builder->remove('username');
     $formModifier = function (FormInterface $form, $type = null) {
         if ($type === User::ROLE_GS1_MEMBER) {
             $form->add('memberProfile', new MemberProfileType(), array('label' => false, 'widget_form_group' => false, 'widget_type' => 'inline', 'constraints' => array(new Valid())))->remove("studentProfile");
         }
     };
     $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use($formModifier) {
         $data = $event->getData();
         $formModifier($event->getForm(), $data !== null ? $data->getType() : null);
     });
     $builder->get('type')->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use($formModifier) {
         $type = $event->getForm()->getData();
         $formModifier($event->getForm()->getParent(), $type);
     });
     $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
         $form = $event->getForm();
         if ($form->getErrors(true)->count() > 0) {
             $form->get('plainPassword')->get('first')->addError(new FormError('The form is invalid, you must re-enter your password'));
         }
     });
     //        $builder->get('activatedAccessCode')
     //            ->addModelTransformer(new StudentAccessCodeTransformer($this->entityManager));
 }
開發者ID:hoangnd25,項目名稱:IndustryProject,代碼行數:28,代碼來源:RegistrationType.php

示例10: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->remove('username');
     $builder->add('firstname', 'text', array('label' => 'register.form.firstname.label'))->add('lastname', 'text', array('label' => 'register.form.lastname.label'))->add('email', 'text', array('label' => 'register.form.email.label'))->add('plainPassword', 'repeated', array('type' => 'password', 'first_options' => array('label' => 'register.form.password.label'), 'second_options' => array('label' => 'register.form.password-confirm.label'), 'invalid_message' => 'fos_user.password.mismatch'));
     $builder->add('registered_disability_group', 'fieldset', ['label' => false, 'legend' => 'register.form.registered-disability-group.legend', 'fields' => [['name' => 'phoneNumber', 'type' => new PhoneNumberEntityFormType(), 'attr' => []], ['name' => 'registration', 'type' => new RegistrationEntityFormType(), 'attr' => []]]]);
     $builder->add('registerButton', 'submit', array('label' => 'register.form.register-button.label'));
 }
開發者ID:transformcore,項目名稱:csr-fast-stream-domain-model,代碼行數:11,代碼來源:ApplicantFormType.php

示例11: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $dateOptions = $builder->get('date')->getOptions();
     $options = array('html5' => false, 'format' => 'dd/MM/yyyy', 'attr' => array('class' => 'datepicker'));
     $dateOptions = array_merge($dateOptions, $options);
     $builder->remove('date')->add('date', 'dspsofts_date_picker', $dateOptions);
 }
開發者ID:dspsofts,項目名稱:cronmanager-bundle,代碼行數:7,代碼來源:DateTimePickerType.php

示例12: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('language', ChoiceType::class, array('label' => 'Language', 'choices' => ['es' => 'Español', 'en' => 'English']));
     $builder->add('bio', TextareaType::class, array('label' => 'Biography', 'required' => false));
     $builder->add('country', CountryType::class, array('label' => 'Country', 'translation_domain' => 'messages'));
     $builder->add('birthday', BirthdayType::class, array('label' => 'Birthday', 'years' => range(date('Y'), 1900)));
     $builder->remove('current_password');
 }
開發者ID:aescarcha,項目名稱:user-bundle,代碼行數:8,代碼來源:ProfileFormType.php

示例13: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $id = $builder->getData()->getBranch()->getMeta()->getId();
     $exclude = $builder->getData()->getBranch()->getId();
     $builder->remove('folder')->remove('packages')->remove('actions')->add('branch', 'entity', array('class' => 'HLPNebulaBundle:Branch', 'expanded' => false, 'multiple' => false, 'query_builder' => function (\HLP\NebulaBundle\Entity\BranchRepository $repo) use($id, $exclude) {
         return $repo->getBranchQueryBuilder($id, $exclude);
     }));
 }
開發者ID:ngld,項目名稱:hlp-nebula,代碼行數:12,代碼來源:BuildTransferType.php

示例14: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->remove('username');
     $builder->add('first_name', 'text', ['label' => 'user.name']);
     $builder->add('last_name', 'text', ['label' => 'user.surname']);
     $builder->add('phone', 'text', ['label' => 'user.phone']);
     $builder->add('birthday', 'birthday', ['label' => 'user.birth_year']);
     $builder->add('description', 'textarea', ['label' => "user.about_me", 'required' => true, 'attr' => ['data-help' => 'user.short_about_me_desc']]);
 }
開發者ID:padedam,項目名稱:padedam,代碼行數:9,代碼來源:ProfileType.php

示例15: baseBuildForm

 static function baseBuildForm(FormBuilderInterface $builder)
 {
     $builder->remove('username')->add('firstName', 'text', ['attr' => ['placeholder' => 'form.profile.firstName'], 'label' => 'form.profile.firstName', 'translation_domain' => 'FOSUserBundle'])->add('lastName', 'text', ['attr' => ['placeholder' => 'form.profile.lastName'], 'label' => 'form.profile.lastName', 'translation_domain' => 'FOSUserBundle']);
     $genderArr = [];
     $arr = Type::getType('genderEnumType')->getChoices();
     foreach ($arr as $key => $value) {
         $genderArr[$key] = 'form.gender.' . $key;
     }
     $builder->add('gender', 'choice', ['label' => 'form.profile.gender', 'choices' => $genderArr, 'translation_domain' => 'FOSUserBundle']);
 }
開發者ID:rotanov,項目名稱:fefu-social-network,代碼行數:10,代碼來源:UserFormBuilder.php


注:本文中的Symfony\Component\Form\FormBuilderInterface::remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。