当前位置: 首页>>代码示例>>PHP>>正文


PHP FormBuilder::add方法代码示例

本文整理汇总了PHP中Symfony\Component\Form\FormBuilder::add方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilder::add方法的具体用法?PHP FormBuilder::add怎么用?PHP FormBuilder::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Form\FormBuilder的用法示例。


在下文中一共展示了FormBuilder::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildForm

 public function buildForm(FormBuilder $builder, array $options)
 {
     $builder->add('product');
     $builder->add('price');
     $builder->add('start_date');
     $builder->add('expire_date');
 }
开发者ID:hollodk,项目名称:clubmaster,代码行数:7,代码来源:Special.php

示例2: buildForm

 public function buildForm(FormBuilder $builder, array $options)
 {
     $builder->add('lastname', 'text', array('label' => 'Lastname', 'required' => false));
     $builder->add('firstname', 'text', array('label' => 'Firstname', 'required' => false));
     $builder->add('username', 'text', array('label' => 'Username', 'required' => false));
     $builder->add('group', 'entity', array('class' => 'CuteFlow\\CoreBundle\\Entity\\UserGroup', 'required' => false, 'label' => 'Usergroup'));
 }
开发者ID:robertowest,项目名称:CuteFlow-V4,代码行数:7,代码来源:UserFilterType.php

示例3: setRequestToken

 protected function setRequestToken()
 {
     if (!\Config::get('disableRefererCheck')) {
         $token = \RequestToken::get();
         $this->builder->add('REQUEST_TOKEN', 'hidden', array('data' => $token));
     }
 }
开发者ID:contaoblackforest,项目名称:contao-symfony-component-form,代码行数:7,代码来源:FormBuilder.php

示例4: buildForm

 public function buildForm(FormBuilder $builder, array $options)
 {
     $builder->add('account');
     $builder->add('user', 'entity', array('class' => 'Club\\UserBundle\\Entity\\User', 'required' => false));
     $builder->add('value');
     $builder->add('note');
 }
开发者ID:hollodk,项目名称:clubmaster,代码行数:7,代码来源:Ledger.php

示例5: buildForm

 public function buildForm(FormBuilder $builder, array $options)
 {
     $hourOptions = $minuteOptions = $secondOptions = array();
     $parts = array('hour', 'minute');
     if ($options['widget'] === 'choice') {
         $hourOptions['choice_list'] = new PaddedChoiceList(array_combine($options['hours'], $options['hours']), 2, '0', STR_PAD_LEFT);
         $minuteOptions['choice_list'] = new PaddedChoiceList(array_combine($options['minutes'], $options['minutes']), 2, '0', STR_PAD_LEFT);
         if ($options['with_seconds']) {
             $secondOptions['choice_list'] = new PaddedChoiceList(array_combine($options['seconds'], $options['seconds']), 2, '0', STR_PAD_LEFT);
         }
     }
     $builder->add('hour', $options['widget'], $hourOptions)->add('minute', $options['widget'], $minuteOptions);
     if ($options['with_seconds']) {
         $parts[] = 'second';
         $builder->add('second', $options['widget'], $secondOptions);
     }
     if ($options['input'] === 'string') {
         $builder->appendNormTransformer(new ReversedTransformer(new DateTimeToStringTransformer($options['data_timezone'], $options['data_timezone'], 'H:i:s')));
     } else {
         if ($options['input'] === 'timestamp') {
             $builder->appendNormTransformer(new ReversedTransformer(new DateTimeToTimestampTransformer($options['data_timezone'], $options['data_timezone'])));
         } else {
             if ($options['input'] === 'array') {
                 $builder->appendNormTransformer(new ReversedTransformer(new DateTimeToArrayTransformer($options['data_timezone'], $options['data_timezone'], $parts)));
             }
         }
     }
     $builder->appendClientTransformer(new DateTimeToArrayTransformer($options['data_timezone'], $options['user_timezone'], $parts, $options['widget'] === 'text'))->setAttribute('widget', $options['widget'])->setAttribute('with_seconds', $options['with_seconds']);
 }
开发者ID:rfc1483,项目名称:blog,代码行数:29,代码来源:TimeType.php

示例6: buildForm

 public function buildForm(FormBuilder $builder, array $options)
 {
     $builder->add('defaultLanguage', 'choice', array('label' => 'Default language', 'choices' => array('de' => 'Deutsch', 'en' => "English")));
     $builder->add('defaultTheme', 'choice', array('choices' => array('basecamp' => 'Basecamp', 'modulaMartini' => 'Modula Martini', 'modulaMojito' => 'Modula Mojito'), 'label' => 'Default theme'));
     $builder->add('useGravatar', 'checkbox', array('label' => 'Use Gravatar user icons'));
     $builder->add('userFormat', 'choice', array('choices' => array('username' => 'jdoe', 'fullname_fl' => 'John Doe', 'fullname_lf' => 'Doe, John', 'firstname' => 'John', 'lastname' => 'Doe'), 'required' => true, 'label' => 'Userformat'));
 }
开发者ID:robertowest,项目名称:CuteFlow-V4,代码行数:7,代码来源:SettingsGeneralType.php

示例7: buildForm

 public function buildForm(FormBuilder $builder, array $options)
 {
     $builder->add('senderEmail');
     $builder->add('senderName');
     $builder->add('subject');
     $builder->add('message', 'textarea');
 }
开发者ID:rafix,项目名称:ContactBundle,代码行数:7,代码来源:ContactFormType.php

示例8: buildForm

 public function buildForm(FormBuilder $builder, array $opciones)
 {
     $builder->add('nombreOpcion', 'text');
     $builder->add('descripcionOpcion', 'text');
     $builder->add('enlace', 'text');
     $builder->add('idOpcionSistema2', 'integer');
 }
开发者ID:Neto2011,项目名称:sidpla-isri,代码行数:7,代码来源:OpcionSistemaType.php

示例9: buildForm

 /**
  * Build form
  *
  * @param FormBuilder $builder
  * @param array       $options
  */
 public function buildForm(FormBuilder $builder, array $options)
 {
     $builder->add('title')->add('description')->add('keywords')->add('template', 'choice', array('choices' => $this->getTemplates()))->add('link')->add('is_published');
     if ($options['data']->getId() !== 1) {
         $builder->add('parent');
     }
 }
开发者ID:nurikabe,项目名称:PagesBundle,代码行数:13,代码来源:PageType.php

示例10: buildForm

 public function buildForm(FormBuilder $builder, array $options)
 {
     $builder->add('lastname', 'text', array('label' => 'rtxlabs.user.label.lastname', 'required' => false));
     $builder->add('firstname', 'text', array('label' => 'rtxlabs.user.label.firstname', 'required' => false));
     $builder->add('username', 'text', array('label' => 'rtxlabs.user.label.username', 'required' => false));
     $builder->add('personnelNumber', 'text', array('label' => 'rtxlabs.user.label.personnel_number', 'required' => false));
 }
开发者ID:rtxwebdev1,项目名称:UserBundle,代码行数:7,代码来源:UserFilterType.php

示例11: buildForm

	public function buildForm(FormBuilder $builder, array $options)
	{
		$builder->add('street');
		$builder->add('zipcode');
		$builder->add('city');
		$builder->add('country');
	}
开发者ID:rubensayshi,项目名称:gogreat-self,代码行数:7,代码来源:AddressType.php

示例12: buildForm

 public function buildForm(FormBuilder $builder, array $options)
 {
     $builder->add('firstname', 'text', array('label' => 'form.label.firstname'))->add('lastname', 'text', array('label' => 'form.label.lastname'))->add('states', 'choice', array('choices' => array('foo' => 'bar'), 'empty_value' => 'form.states.empty_value'))->add('countries', 'choice', array('empty_value' => false))->add('password', 'repeated', array('first_options' => array('label' => 'form.label.password'), 'second_options' => array('label' => 'form.label.password_repeated'), 'invalid_message' => 'form.error.password_mismatch'))->add('street', 'text', array('label' => 'form.label.street', 'translation_domain' => 'address'))->add('zip', 'text', array('label' => 'form.label.zip', 'translation_domain' => 'address'))->add('field_with_placeholder', 'text', array('label' => 'field.with.placeholder', 'attr' => array('placeholder' => 'form.placeholder.text')))->add('field_without_label', 'text', array('label' => false, 'attr' => array('placeholder' => 'form.placeholder.text.but.no.label')));
     $child = $builder->create('created', 'text', array('label' => 'form.label.created'));
     $builder->add('dueDate', 'date', array('empty_value' => array('year' => 'form.dueDate.empty.year', 'month' => 'form.dueDate.empty.month', 'day' => 'form.dueDate.empty.day')));
     $builder->add('field_with_ignored_label', 'text', array('label' => 'form.ignored'));
 }
开发者ID:GabLeRoux,项目名称:JMSTranslationBundle,代码行数:7,代码来源:MyFormType.php

示例13: buildForm

 /**
  * Configures a Comment form.
  *
  * @param FormBuilder $builder
  * @param array $options
  */
 public function buildForm(FormBuilder $builder, array $options)
 {
     $builder->add('message', 'textarea');
     if (!$this->securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
         $builder->add('authorName', 'text');
     }
 }
开发者ID:hafeez3000,项目名称:lichess,代码行数:13,代码来源:PostFormType.php

示例14: buildForm

 public function buildForm(FormBuilder $builder, array $options)
 {
     if (!isset($options['currency'])) {
         throw new \InvalidArgumentException(sprintf('The option "currency" must be given for form type "%s".', $this->getName()));
     }
     if (!isset($options['amount'])) {
         throw new \InvalidArgumentException(sprintf('The option "amount" must be given for form type "%s".', $this->getName()));
     }
     $allowAllMethods = !isset($options['allowed_methods']);
     $options['available_methods'] = array();
     foreach ($this->paymentMethods as $method) {
         if (!$allowAllMethods && !in_array($method, $options['allowed_methods'], true)) {
             continue;
         }
         $options['available_methods'][] = $method;
     }
     if (!$options['available_methods']) {
         throw new \RuntimeException(sprintf('You have not selected any payment methods. Available methods: "%s"', implode(', ', $this->paymentMethods)));
     }
     $builder->add('method', 'choice', array('choices' => $this->buildChoices($options['available_methods']), 'expanded' => true));
     foreach ($options['available_methods'] as $method) {
         $methodOptions = isset($options['method_options'][$method]) ? $options['method_options'] : array();
         $builder->add('data_' . $method, $method, $methodOptions);
     }
     $self = $this;
     $builder->addValidator(new CallbackValidator(function ($form) use($self, $options) {
         $self->validate($form, $options);
     }));
     $builder->appendNormTransformer(new CallbackTransformer(function ($data) use($self, $options) {
         return $self->transform($data, $options);
     }, function ($data) use($self, $options) {
         return $self->reverseTransform($data, $options);
     }));
 }
开发者ID:novatex,项目名称:JMSPaymentCoreBundle,代码行数:34,代码来源:ChoosePaymentMethodType.php

示例15: buildForm

 public function buildForm(FormBuilder $builder, array $options)
 {
     $builder->add('name');
     $builder->add('email', 'email');
     $builder->add('subject');
     $builder->add('body', 'textarea');
 }
开发者ID:ricfrank,项目名称:www.lebowskienico.it,代码行数:7,代码来源:EnquiryType.php


注:本文中的Symfony\Component\Form\FormBuilder::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。