本文整理汇总了PHP中Symfony\Component\Form\FormBuilderInterface::add方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilderInterface::add方法的具体用法?PHP FormBuilderInterface::add怎么用?PHP FormBuilderInterface::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\FormBuilderInterface
的用法示例。
在下文中一共展示了FormBuilderInterface::add方法的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');
}
示例2: 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]);
}
示例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'));
}
}
示例4: 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')));
}
示例5: 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'));
}
示例6: 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'));
}
示例7: 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' => 'Заказать'));
}
示例8: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('label', 'text', array('required' => true, 'label' => 'oro.dashboard.label'));
if ($options['create_new']) {
$builder->add('startDashboard', 'oro_dashboard_select', array('required' => false, 'label' => 'oro.dashboard.start_dashboard'));
}
}
示例9: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('page_url', 'text', ['label' => 'mautic.page.point.action.form.page.url', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.page.point.action.form.page.url.descr', 'placeholder' => 'http://']]);
// $default = (isset($options['data']) && isset($options['data']['first_time'])) ? $options['data']['first_time'] : false;
// $builder->add('first_time', 'yesno_button_group', array(
// 'label' => 'mautic.page.point.action.form.first.time.only',
// 'attr' => array(
// 'tooltip' => 'mautic.page.point.action.form.first.time.only.descr'
// ),
// 'data' => $default
// ));
$builder->add('page_hits', 'integer', ['label' => 'mautic.page.hits', 'label_attr' => ['class' => 'control-label'], 'required' => false, 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.page.point.action.form.page.hits.descr']]);
$formModifier = function (FormInterface $form, $data) use($builder) {
$unit = isset($data['accumulative_time_unit']) ? $data['accumulative_time_unit'] : 'H';
$form->add('accumulative_time_unit', 'hidden', ['data' => $unit]);
$secondsTransformer = new SecondsConversionTransformer($unit);
$form->add($builder->create('accumulative_time', 'text', ['label' => 'mautic.page.point.action.form.accumulative.time', 'required' => false, 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.page.point.action.form.accumulative.time.descr'], 'auto_initialize' => false])->addViewTransformer($secondsTransformer)->getForm());
$unit = isset($data['returns_within_unit']) ? $data['returns_within_unit'] : 'H';
$secondsTransformer = new SecondsConversionTransformer($unit);
$form->add('returns_within_unit', 'hidden', ['data' => $unit]);
$form->add($builder->create('returns_within', 'text', ['label' => 'mautic.page.point.action.form.returns.within', 'required' => false, 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.page.point.action.form.returns.within.descr', 'onBlur' => 'Mautic.EnablesOption(this.id)'], 'auto_initialize' => false])->addViewTransformer($secondsTransformer)->getForm());
$unit = isset($data['returns_after_unit']) ? $data['returns_after_unit'] : 'H';
$secondsTransformer = new SecondsConversionTransformer($unit);
$form->add('returns_after_unit', 'hidden', ['data' => $unit]);
$form->add($builder->create('returns_after', 'text', ['label' => 'mautic.page.point.action.form.returns.after', 'required' => false, 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.page.point.action.form.returns.after.descr', 'onBlur' => 'Mautic.EnablesOption(this.id)'], 'auto_initialize' => false])->addViewTransformer($secondsTransformer)->getForm());
};
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use($formModifier) {
$data = $event->getData();
$formModifier($event->getForm(), $data);
});
$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use($formModifier) {
$data = $event->getData();
$formModifier($event->getForm(), $data);
});
}
示例10: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name', 'text', ['label' => 'Task name', 'required' => true, 'constraints' => [new Assert\NotBlank()]]);
$builder->add('period', 'integer', ['label' => 'Task period (in seconds)', 'required' => true, 'constraints' => [new Assert\NotBlank(), new Assert\GreaterThan(['value' => 0])]]);
$builder->add('status', 'choice', ['label' => 'The task status', 'choices' => [Task::STATUS_STARTED => 'Started', Task::STATUS_STOPPED => 'Stopped']]);
$builder->add('settings', 'hidden');
}
示例11: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('enabled', 'choice', ['choices' => ['0' => 'Off', '1' => 'On'], 'multiple' => false, 'expanded' => true, 'required' => true]);
$builder->add('name', 'text', ['disabled' => true]);
$builder->add('type', 'text', ['disabled' => true]);
$builder->add('icon', 'text', ['required' => true]);
}
示例12: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('login', 'text');
$builder->add('password', 'password');
$builder->add('server', 'text');
$builder->add('zaloguj', 'submit', array('label' => 'Zaloguj'));
}
示例13: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('fieldName', 'text', array('label' => 'Field Name', 'block' => 'type'));
$entityProvider = $this->configManager->getProvider('entity');
$extendProvider = $this->configManager->getProvider('extend');
$entityConfig = $extendProvider->getConfig($options['class_name']);
if ($entityConfig->is('relation')) {
$types = array();
foreach ($entityConfig->get('relation') as $relationKey => $relation) {
$fieldId = $relation['field_id'];
$targetFieldId = $relation['target_field_id'];
if (!$relation['assign'] || !$targetFieldId) {
continue;
}
if ($fieldId && $extendProvider->hasConfigById($fieldId) && !$extendProvider->getConfigById($fieldId)->is('state', ExtendManager::STATE_DELETED)) {
continue;
}
$entityLabel = $entityProvider->getConfig($targetFieldId->getClassName())->get('label');
$fieldLabel = $entityProvider->getConfigById($targetFieldId)->get('label');
$key = $relationKey . '||' . ($fieldId ? $fieldId->getFieldName() : '');
$types[$key] = 'Relation (' . $entityLabel . ') ' . $fieldLabel;
}
$this->types = array_merge($this->types, $types);
}
$builder->add('type', 'choice', array('choices' => $this->types, 'empty_value' => 'Please choice type...', 'block' => 'type'));
}
示例14: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('primer_nombre', 'filter_text', array('label' => 'Primer Nombre'));
$builder->add('primer_apellido', 'filter_text', array('label' => 'Primer Apellido'));
$builder->add('numero_documento', 'filter_text', array('label' => 'Número de Documento'));
$builder->add('username', 'filter_text', array('label' => 'Nombre de usuario'));
}
示例15: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('title', TextType::class);
$builder->add('caption', CKEditorType::class, array('config' => array('uiColor' => '#ffffff')));
$builder->add('panels', 'collection', array('type' => new PanelType(), 'allow_add' => true, 'allow_delete' => true, 'label' => "Carousel", 'options' => array('data_class' => 'Adam\\AdminBundle\\Entity\\Panel'), 'prototype' => true, 'attr' => array('class' => 'parent-collection', 'image' => "image")));
$builder->add('homePageRows', 'collection', array('type' => new PanelType(), 'allow_add' => true, 'allow_delete' => true, 'label' => "Home Page Rows", 'options' => array('data_class' => 'Adam\\AdminBundle\\Entity\\Panel'), 'prototype' => true, 'attr' => array('class' => 'parent-collection', 'image' => "image")));
}