本文整理汇总了PHP中Symfony\Component\Form\FormBuilderInterface::setMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilderInterface::setMethod方法的具体用法?PHP FormBuilderInterface::setMethod怎么用?PHP FormBuilderInterface::setMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\FormBuilderInterface
的用法示例。
在下文中一共展示了FormBuilderInterface::setMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
//第一步:设置表单的基本属性,从控制器中中设置变成在这里设置
$builder->setMethod('post');
$builder->setAction($this->router->generate('web_user_register_check'));
//$builder->setAttribute('class', 'form-horizontal');
//第二步:添加表单的相关元素
//1.添加电子邮箱
$builder->add('email', 'text', array('attr' => array('class' => 'form-control', 'placeholder' => '请输入您的电子邮箱', 'wx-validator-rule' => 'required|email'), 'label' => '电子邮箱', 'label_attr' => array('class' => 'col-md-3 control-label')));
//add end
//2.添加密码
$builder->add('password', 'text', array('attr' => array('class' => 'form-control', 'placeholder' => '请输入密码', 'wx-validator-rule' => 'required'), 'label' => '密码', 'label_attr' => array('class' => 'col-md-3 control-label')));
//add end
//3.添加确认密码
$builder->add('confirm_password', 'text', array('attr' => array('class' => 'form-control', 'placeholder' => '请输入确认密码', 'wx-validator-rule' => 'required'), 'label' => '确认密码', 'label_attr' => array('class' => 'col-md-3 control-label')));
//add end
//4.添加用户昵称
$builder->add('nickname', 'text', array('attr' => array('class' => 'form-control', 'placeholder' => '请输入昵称', 'wx-validator-rule' => 'required'), 'label' => '昵称', 'label_attr' => array('class' => 'col-md-3 control-label')));
//add end
//5.添加手机号码
$builder->add('cellphone', 'text', array('attr' => array('class' => 'form-control', 'placeholder' => '请输入手机号', 'wx-validator-rule' => 'required|mobile'), 'label' => '手机号', 'label_attr' => array('class' => 'col-md-3 control-label')));
//add end
//6.添加手机验证码
$builder->add('capcha', 'text', array('attr' => array('class' => 'form-control', 'placeholder' => '请输入验证码', 'wx-validator-rule' => 'required|email'), 'label' => '验证码', 'label_attr' => array('class' => 'col-md-3 control-label')));
//add end
}
示例2: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setAction($this->urlGenerator->generate($options['route'], $options['route_parameters']));
$builder->setMethod('POST');
$builder->add('locale', 'choice', ['label' => false, 'required' => true, 'widget_addon_prepend' => ['icon' => 'language'], 'choices' => $this->localeChoiceList->create(), 'choices_as_values' => true]);
$builder->add('switch', 'submit', ['label' => 'stepup_middleware_client.form.switch_locale.switch', 'attr' => ['class' => 'btn btn-default']]);
}
示例3: buildForm
public function buildForm( FormBuilderInterface $builder, array $options )
{
$builder
->setMethod( 'GET' )
->add( 'searchText', 'search' )
->add( 'save', 'submit' );
}
示例4: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('username', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType', array('required' => false, 'label' => 'sugg.username'));
$builder->add('dateini', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\DateType', array('required' => false, 'format' => 'dd/MM/yyyy', 'widget' => 'single_text', 'years' => range(date('Y'), 1898), 'label' => 'sugg.dateini', 'attr' => array('pattern' => '[0-9/]*', 'class' => 'date')));
$builder->add('dateend', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\DateType', array('required' => false, 'format' => 'dd/MM/yyyy', 'widget' => 'single_text', 'years' => range(date('Y'), 1898), 'label' => 'sugg.dateend', 'attr' => array('pattern' => '[0-9/]*', 'class' => 'date')));
$builder->add('text', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType', array('required' => false, 'label' => 'sugg.text'));
$builder->setMethod('GET');
}
示例5: buildForm
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setMethod('GET');
$builder->add('teamName', 'text', array('label' => 'lg.friendly_match.fields.teamName'));
$builder->add('status', 'choice', array('label' => 'lg.friendly_match.fields.status', 'empty_value' => 'lg.core.all', 'choices' => \CoreBundle\Entity\FriendlyMatch::getAvailableStatus()));
$builder->add('type', 'choice', array('label' => 'lg.friendly_match.fields.type', 'empty_value' => 'lg.core.all', 'choices' => \CoreBundle\Entity\FriendlyMatch::getAvailableTypes()));
$builder->add('submit', 'submit', array('label' => 'lg.core.search'));
}
示例6: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
// this assumes that the entity manager was passed in as an optio
$em = ServiceUtil::getService('doctrine.entitymanager');
// $entityManager = $options['em'];
$transformer = new UserToIdTransformer($em);
$builder->setMethod('POST')->add('online', 'choice', array('choices' => array('0' => 'Offline', '1' => 'Online'), 'multiple' => false, 'expanded' => true, 'required' => true))->add('depot', 'choice', array('choices' => array('0' => 'Depot', '1' => 'Allowed'), 'multiple' => false, 'expanded' => true, 'required' => true))->add('inmenu', 'choice', array('choices' => array('0' => 'Not in menus', '1' => 'In menus'), 'multiple' => false, 'expanded' => true, 'required' => true))->add('inlist', 'choice', array('choices' => array('0' => 'Not in list', '1' => 'In List'), 'multiple' => false, 'expanded' => true, 'required' => true))->add('title', 'text', array('required' => false))->add('urltitle', 'text', array('required' => false))->add($builder->create('author', 'text', ['attr' => ['class' => 'author_search']])->addModelTransformer($transformer))->add('views', 'text', array('required' => false))->add('publishedAt', 'datetime', array('format' => \IntlDateFormatter::SHORT, 'input' => 'datetime', 'required' => false, 'widget' => 'single_text'))->add('expiredAt', 'datetime', array('format' => \IntlDateFormatter::SHORT, 'input' => 'datetime', 'required' => false, 'widget' => 'single_text'))->add('images', 'collection', array('type' => new ImageType(), 'allow_add' => true, 'required' => false, 'delete_empty' => true, 'by_reference' => false, 'allow_delete' => true, 'prototype' => true))->add('layout', 'choice', array('choices' => array('default' => 'Default', 'slider' => 'Slider'), 'preferred_choices' => array('default'), 'required' => false))->add('language', 'choice', array('choices' => array('any' => 'Any', 'en' => 'English', 'pl' => 'Polish')))->add('content', 'textarea', array('required' => false, 'attr' => array('class' => 'tinymce')))->add('description', 'textarea', array('required' => false, 'attr' => array('class' => 'tinymc')))->add('save', 'submit', array('label' => 'Save'));
}
示例7: createForm
public function createForm(FormBuilderInterface $formBuilder)
{
$formBuilder->setMethod('GET');
$formBuilder->add('status', ChoiceType::class, ['label' => 'Status', 'choices' => $this->translateStatus(AreaRequest::statusList()), 'required' => false]);
$formBuilder->add('territory', ChoiceType::class, ['label' => 'Territory', 'choices' => $this->territoryRepository->getFormChoices(), 'required' => false]);
$formBuilder->add('submit', SubmitType::class, ['label' => 'Filter']);
$formBuilder->get('territory')->addModelTransformer(new EntityTransformer($this->territoryRepository));
return $formBuilder->getForm();
}
示例8: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setAction($this->targetUrl);
$builder->setMethod('POST');
foreach ($this->configs as $key => $config) {
$builder->add($key, 'text', array('label' => $config['label'], 'data' => $config['default']));
}
$builder->add('save', 'submit', array('label' => 'Générer le segment'));
}
示例9: buildForm
/**
* @param FormBuilderInterface $builder
* @param array $options
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setMethod('POST');
$builder->setAttribute('role', 'form');
$builder->add('username', 'text', array('label' => false, 'attr' => array('placeholder' => 'Enter username', 'class' => 'form-control')));
$builder->add('password', 'password', array('label' => false, 'attr' => array('placeholder' => 'Enter password', 'class' => 'form-control')));
$builder->add('target_path', 'hidden', array('label' => false, 'attr' => array('value' => "/")));
$builder->add('recaptcha', 'captcha', array('label' => false, 'width' => 270, 'height' => 60, 'length' => 5));
$builder->add('login', 'submit', array('label' => "Login", 'attr' => array('class' => 'btn btn-default')));
}
示例10: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setMethod('GET');
$builder->add('search', TextType::class, ['attr' => ['class' => 'form-control', 'placeholder' => 'placeholder.search']]);
$builder->add('send', SubmitType::class, ['label' => 'send', 'attr' => ['class' => 'btn btn-primary']]);
# advanced search
$builder->add('inside_dir', TextType::class, ['label' => 'inside_dir', 'attr' => ['class' => 'form-control', 'placeholder' => 'placeholder.inside_dir'], 'required' => false]);
$builder->add('file_name', TextType::class, ['label' => 'file_name', 'attr' => ['class' => 'form-control', 'placeholder' => 'placeholder.file_name'], 'required' => false]);
$builder->add('rows_per_page', TextType::class, ['label' => 'rows_per_page', 'attr' => ['class' => 'form-control'], 'required' => false, 'data' => $options['data']['rowsPerPage']]);
$builder->add('ignore_cache', CheckboxType::class, ['label' => 'ignore.cache.dir', 'required' => false, 'data' => true]);
$builder->add('ignore_vendor', CheckboxType::class, ['label' => 'ignore.vendor.dir', 'required' => false, 'data' => true]);
$builder->add('ignore_log', CheckboxType::class, ['label' => 'ignore.log.dir', 'required' => false, 'data' => true]);
}
示例11: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setMethod('GET');
$builder->add('limit', ChoiceType::class, ['choices' => ['5' => '5', '10' => '10', '25' => '25', '50' => '50', '100' => '100', '250' => '250', '500' => '500'], 'required' => false, 'placeholder' => 'LIMIT LOGS']);
$builder->add('level', ChoiceType::class, ['choices' => ['EMERGENCY' => 'EMERGENCY', 'ALERT' => 'ALERT', 'CRITICAL' => 'CRITICAL', 'ERROR' => 'ERROR', 'WARNING' => 'WARNING', 'NOTICE' => 'NOTICE', 'INFO' => 'INFO', 'DEBUG' => 'DEBUG'], 'required' => false, 'placeholder' => 'ALL LEVEL']);
$builder->add('date', ChoiceType::class, ['choices' => ['LAST 1 HOURS' => '-1 hour', 'LAST 3 HOURS' => '-3 hour', 'LAST 6 HOURS' => '-6 hour', 'LAST 12 HOURS' => '-12 hour', 'LAST 1 DAYS' => '-1 day', 'LAST 3 DAYS' => '-3 day', 'LAST 7 DAYS' => '-7 day', 'LAST 30 DAYS' => '-30 day', 'LAST 60 DAYS' => '-60 day', 'LAST 90 DAYS' => '-90 day'], 'required' => false, 'placeholder' => 'ALL DATE']);
$builder->get('date')->addModelTransformer(new CallbackTransformer(function () {
return null;
}, function ($dateAsString) {
if (!$dateAsString) {
return null;
}
$date = new \DateTime();
$date->modify($dateAsString);
return $date;
}));
$builder->add('message', TextType::class, ['attr' => ['placeholder' => 'SEARCH IN MESSAGES'], 'required' => false]);
$builder->add('save', SubmitType::class, array('label' => 'FILTER'));
}
示例12: buildForm
/**
* (non-PHPdoc)
* @see \Symfony\Component\Form\AbstractType::buildForm()
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setMethod('GET')->add('url', 'text', ['label' => 'URL address', 'attr' => ['placeholder' => $this->host . '/']])->add('frames', 'checkbox', ['label' => 'Upload frames', 'required' => false]);
}
示例13: buildForm
/**
* Buildform function
*
* @param FormBuilderInterface $builder the formBuilder
* @param array $options the options for this form
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setMethod('POST')->add('password', 'repeated', ['type' => 'password', 'first_options' => ['label' => 'store.recovery.form.fields.password.label'], 'second_options' => ['label' => 'store.recovery.form.fields.repeat_password.label'], 'required' => true])->add('send', 'submit', ['label' => 'store.recovery.form.fields.send.label']);
}
示例14: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setMethod('POST')->add('libelle', TextType::class, ['label' => "Choisir un nom de produit : ", 'constraints' => [new NotBlank(), new Length(['min' => 3])]])->add('save', SubmitType::class, ['label' => "Créer"]);
}
示例15: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setMethod('PUT')->add('title')->add('classLevel', 'choice', array('choices' => array('1' => 'Première S', '2' => 'Terminale S'), 'required' => true))->add('questions', 'collection', array('type' => new QuestionsType(), 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false))->add('status', 'choice', array('choices' => array('publish' => 'Publié', 'unpublish' => 'Non Publié')))->add('publish', 'checkbox', array('required' => false, 'mapped' => false))->add('valider', 'submit');
}