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


PHP Form\FormBuilderInterface類代碼示例

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


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

示例1: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('author', 'text');
     $builder->add('email', 'email');
     $builder->add('website', 'url', array('required' => false));
     $builder->add('content', 'textarea');
 }
開發者ID:pitoukhmer,項目名稱:protalk,代碼行數:7,代碼來源:CommentMedia.php

示例2: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('tags', TextType::class, array('label' => false, 'constraints' => array(new Length(array('min' => 2, 'max' => 50))), 'attr' => array('class' => 'form-control')));
     $builder->add('filter', ChoiceType::class, array('choices' => array('Tout' => 'all', 'Forum' => 'forum', 'Offres' => 'offer', 'Evenements' => 'hall', 'Profils' => 'profile'), 'choices_as_values' => true, 'expanded' => true, 'multiple' => false));
     $builder->add('method', ChoiceType::class, array('choices' => array('ET' => 'and', 'OU' => 'or'), 'choices_as_values' => true, 'expanded' => true, 'multiple' => false));
     $builder->add('no', TextType::class, array('label' => false, 'required' => false, 'constraints' => array(new Length(array('min' => 2, 'max' => 50))), 'attr' => array('class' => 'form-control')));
 }
開發者ID:yoannfleurydev,項目名稱:amicale-src,代碼行數:7,代碼來源:SearchAdvancedType.php

示例3: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('body', null, array('attr' => array('rows' => 20), 'label' => 'lexik_mailer.translations.subject'));
     if ($options['with_language']) {
         $builder->add('lang', 'language', array('preferred_choices' => $options['preferred_languages'], 'label' => 'lexik_mailer.translations.subject'));
     }
 }
開發者ID:bendavies,項目名稱:LexikMailerBundle,代碼行數:10,代碼來源:LayoutTranslationType.php

示例4: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $transformer = new ManyRelatedTransformer($this->doctrineRegistry, $options['entityName']);
     $viewTransformer = new ArrayToStringTransformer();
     $builder->addModelTransformer($transformer);
     $builder->addViewTransformer($viewTransformer);
 }
開發者ID:profcab,項目名稱:ilios,代碼行數:7,代碼來源:ManyRelatedType.php

示例5: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('id', 'hidden');
     $builder->add('name', 'text', array('label' => 'bankholiday.field.name'));
     $builder->add('date', 'datePicker', array('label' => 'bankholiday.field.date'));
     $builder->add('memo', 'textarea', array('required' => false, 'label' => 'bankholiday.field.memo'));
 }
開發者ID:binaryfr3ak,項目名稱:sfitixi,代碼行數:11,代碼來源:BankHolidayType.php

示例6: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('address', TextType::class, array('label' => 'Адрес доставки'));
     $builder->add('phone', TextType::class, array('label' => 'Телефон'));
     $builder->add('name', TextType::class, array('label' => 'ФИО'));
     $builder->add('submit', SubmitType::class, array('label' => 'Заказать'));
 }
開發者ID:novuscom,項目名稱:cmfbundle,代碼行數:11,代碼來源:OrderType.php

示例7: buildForm

 /**
  * Builds the form.
  *
  * This method is called for each type in the hierarchy starting form the
  * top most type. Type extensions can further modify the form.
  *
  * @param FormBuilderInterface $builder The form builder
  * @param array $options The options
  *
  * @see FormTypeExtensionInterface::buildForm()
  *
  * @return void
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $folder = $options['folder'];
     $builder->add('name', null, array('label' => 'media.folder.addsub.form.name'))->add('rel', ChoiceType::class, array('choices' => array('media' => 'media', 'image' => 'image', 'slideshow' => 'slideshow', 'video' => 'video'), 'choices_as_values' => true, 'label' => 'media.folder.addsub.form.rel'))->add('parent', EntityType::class, array('class' => 'KunstmaanMediaBundle:Folder', 'choice_label' => 'optionLabel', 'label' => 'media.folder.addsub.form.parent', 'required' => true, 'query_builder' => function (FolderRepository $er) use($folder) {
         return $er->selectFolderQueryBuilder($folder);
     }))->add('internalName', TextType::class, array('label' => 'media.folder.addsub.form.internal_name', 'required' => false));
 }
開發者ID:bakie,項目名稱:KunstmaanBundlesCMS,代碼行數:20,代碼來源:FolderType.php

示例8: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('email', EmailType::class, ['required' => true]);
     $builder->add('subject', TextType::class, ['required' => true]);
     $builder->add('content', TextareaType::class, ['required' => true]);
     $builder->add('captcha', CaptchaType::class, ['required' => true]);
 }
開發者ID:DeFreitas,項目名稱:raphael.de-freitas.net,代碼行數:10,代碼來源:ContactType.php

示例9: buildForm

 /**
  * Builds the form.
  *
  * This method is called for each type in the hierarchy starting form the
  * top most type. Type extensions can further modify the form.
  *
  * @see FormTypeExtensionInterface::buildForm()
  *
  * @param FormBuilderInterface $builder The form builder
  * @param array $options The options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('days', IntegerType::class, array('label' => 'kuma_lead_generation.form.recurring_every_x_time.days.label', 'required' => false));
     $builder->add('hours', IntegerType::class, array('label' => 'kuma_lead_generation.form.recurring_every_x_time.hours.label', 'required' => false));
     $builder->add('minutes', IntegerType::class, array('label' => 'kuma_lead_generation.form.recurring_every_x_time.minutes.label', 'required' => false));
     $builder->add('times', IntegerType::class, array('label' => 'kuma_lead_generation.form.recurring_every_x_time.times.label'));
 }
開發者ID:Kunstmaan,項目名稱:KunstmaanLeadGenerationBundle,代碼行數:18,代碼來源:RecurringEveryXTimeAdminType.php

示例10: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->setRequired($options['required'])->setDisabled($options['disabled'])->setErrorBubbling($options['error_bubbling'])->setEmptyData($options['empty_data'])->setPropertyPath($options['property_path'])->setMapped($options['mapped'])->setByReference($options['by_reference'])->setVirtual($options['virtual'])->setCompound($options['compound'])->setData(isset($options['data']) ? $options['data'] : null)->setDataLocked(isset($options['data']))->setDataMapper($options['compound'] ? new PropertyPathMapper($this->propertyAccessor) : null);
     if ($options['trim']) {
         $builder->addEventSubscriber(new TrimListener());
     }
 }
開發者ID:nfabre,項目名稱:symfony,代碼行數:10,代碼來源:FormType.php

示例11: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $type = $builder->getData()->getNode()->getType();
     if (isset($this->nodeExtensions[$type])) {
         $this->nodeExtensions[$type]->buildForm($builder, $options);
     }
 }
開發者ID:clastic,項目名稱:clastic,代碼行數:11,代碼來源:NodeTypeExtension.php

示例12: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addModelTransformer($this->denormalizedEntityTransformer);
     $this->tagManager->setLocale($options['locale']);
     // On Pre-Submit, create the news posted Tags otherwise the form won't be valid
     $builder->addEventListener(FormEvents::PRE_SUBMIT, function ($event) use($options) {
         // Data when posted
         $tags = $event->getData();
         $entity = $event->getForm()->getParent()->getData();
         // Loop through the posted tags (if not numeric, it's a news Tag)
         if (is_array($tags)) {
             foreach ($tags as $key => $tagId) {
                 if (!is_numeric($tagId)) {
                     $tag = $this->tagManager->loadOrCreateTag($tagId, $options['use_global_tags'] ? null : $entity->getResourceType());
                     $tags[$key] = $tag->getId();
                     $entity->setTagsUpdatedAt(new \DateTime());
                 }
             }
             // Update the posted data with the newly created tags
             $event->setData($tags);
             $this->taggableListener->setNeedToFlush(true);
         } elseif (null === $tags && count($entity->getTags())) {
             // All tags are removed
             $this->taggableListener->setNeedToFlush(true);
         }
     }, 900);
 }
開發者ID:smart85,項目名稱:UnifikDoctrineBehaviorsBundle,代碼行數:30,代碼來源:TaggableType.php

示例13: buildForm

 /**
  * Adds a CSRF field to the form when the CSRF protection is enabled.
  *
  * @param FormBuilderInterface $builder The form builder
  * @param array                $options The options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if (!$options['csrf_protection']) {
         return;
     }
     $builder->addEventSubscriber(new CsrfValidationListener($options['csrf_field_name'], $options['csrf_token_manager'], $options['csrf_token_id'] ?: ($builder->getName() ?: get_class($builder->getType()->getInnerType())), $options['csrf_message'], $this->translator, $this->translationDomain));
 }
開發者ID:Kyra2778,項目名稱:AMR,代碼行數:13,代碼來源:FormTypeCsrfExtension.php

示例14: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $deliveries = $options['deliveries'];
     $delivery = $options['delivery'];
     $deliveryDates = $options['deliveryDates'];
     $builder->add('delivery', 'entity', array('class' => 'Eccube\\Entity\\Delivery', 'property' => 'name', 'choices' => $deliveries, 'data' => $delivery))->add('deliveryDate', 'choice', array('choices' => $deliveryDates, 'required' => false, 'empty_value' => '指定なし'))->add('deliveryTime', 'entity', array('class' => 'Eccube\\Entity\\DeliveryTime', 'property' => 'deliveryTime', 'choices' => $delivery->getDeliveryTimes(), 'required' => false, 'empty_value' => '指定なし', 'empty_data' => null))->addEventSubscriber(new \Eccube\Event\FormEventSubscriber());
 }
開發者ID:hiroyasu55,項目名稱:ec-cube,代碼行數:10,代碼來源:ShoppingMultipleType.php

示例15: DisableFieldSubscriber

 function it_builds_form(FormBuilderInterface $builder)
 {
     $builder->add('code')->shouldBeCalled();
     $builder->addEventSubscriber(new DisableFieldSubscriber('code'))->shouldBeCalled();
     $builder->add('label', 'pim_translatable_field', ['field' => 'label', 'translation_class' => 'Pim\\Bundle\\CatalogBundle\\Entity\\AssociationTypeTranslation', 'entity_class' => 'Pim\\Bundle\\CatalogBundle\\Entity\\AssociationType', 'property_path' => 'translations'])->shouldBeCalled();
     $this->buildForm($builder, []);
 }
開發者ID:ashutosh-srijan,項目名稱:findit_akeneo,代碼行數:7,代碼來源:AssociationTypeTypeSpec.php


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