本文整理汇总了PHP中Symfony\Component\Form\AbstractType::buildForm方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractType::buildForm方法的具体用法?PHP AbstractType::buildForm怎么用?PHP AbstractType::buildForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\AbstractType
的用法示例。
在下文中一共展示了AbstractType::buildForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$em = $options['em'];
$goalTransformer = new GoalToIdTransformer($em);
$builder->add('start_at', 'date', array("mapped" => false, 'widget' => 'single_text', 'format' => 'yyyy-MM-dd'))->add('title', 'text', array('label' => 'action.daily_action.create_new'))->add('goal', null, array('required' => false))->add('position', null, array('required' => false, 'mapped' => false))->add('add', 'submit', array('label' => 'common.add'));
}
示例2: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('nombrePsaude', 'entity', array('class' => 'EntityBundle:ProblemasSaude', 'multiple' => true, 'required' => false));
/*->add('paciente_problemassaude', 'collection', array(
'type' => new \Paciente_ProblemasSaudeType(),
//'label' => 'Orden Responsavels',
'by_reference' => false,
'required' => false
//'prototype_data' => new \EntityBundle\Entity\Orden_Responsavel()
//'allow_delete' => true,
//'allow_add' => true,
//'attr' => array(
// 'class' => 'row addresses'
//)
));*/
//->add('nome1', 'text')
//->add('ocupacao1')
//->add('telefContato1', 'text', array('label' => 'Telef de Contato'))
//->add('email1', 'email');
/*->add('ordenresponsavels', 'collection', array(
'type' => new OneResponsavelType(),
//'label' => 'Direcciones',
'by_reference' => false,
'allow_delete' => true,
'allow_add' => true,
))*/
// ->add('nome1', 'text')
// ->add('ocupacao1')
// ->add('telefContato1', 'text', array('label' => 'Telef de Contato'))
//->add('email1', 'email');
}
示例3: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('firstName');
$builder->add('lastName');
$builder->add('nickname');
}
示例4: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('firstName', null, ['description' => 'First name to search for']);
$builder->add('lastName', null, ['description' => 'Last name to search for']);
$builder->add('nickname', null, ['description' => 'Nickname to search for']);
}
示例5: buildForm
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('roles', 'collection', array('type' => 'choice', 'options' => array('label' => false, 'choices' => array('ROLE_USER' => 'Utilisateur', 'ROLE_MODERATEUR' => 'Moderateur', 'ROLE_ADMIN' => 'Admin'))));
$builder->add('firstname');
$builder->add('lastname');
}
示例6: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$availableFormsNames = $this->dynamicFormsChildrenMap->getFormsNamesByGroup($options['group']);
$this->addAvailableFormsField($builder, $availableFormsNames, $options);
$this->addAvailableFormsPrototypes($builder, $availableFormsNames);
}
示例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()
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('title', 'text', array('required' => false));
$builder->add('description', 'wysiwyg', array('required' => false));
$builder->add('icon', 'choice', array('required' => true, 'choices' => ['code' => 'Code', 'wrench' => 'Wrench']));
}
示例8: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
if (!$options['expanded']) {
throw new LogicException('The option "expanded" cannot the set to false, use the choice field instead.');
}
}
示例9: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$countries = Intl::getRegionBundle()->getCountryNames();
// add your custom field
$builder->add('email', 'email', array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))->add('username', null, array('label' => 'form.username', 'translation_domain' => 'FOSUserBundle'))->add('plainPassword', 'repeated', array('type' => 'password', 'options' => array('translation_domain' => 'FOSUserBundle'), 'first_options' => array('label' => 'form.password'), 'second_options' => array('label' => 'form.password_confirmation'), 'invalid_message' => 'fos_user.password.mismatch'))->add('lastname', 'text')->add('firstname', 'text')->add('image', new AetImageType())->add('pays', 'country', array('expanded' => false, 'multiple' => false))->add('matricule', 'text')->add('whoami', 'textarea', array('required' => false))->add('ville', 'text')->add('code_postale', 'text')->add('telephone', 'text')->add('activite_principale', 'choice', array('choices' => array('Art, Design' => 'Art, Design', 'Audiovisuel - Spectacle' => 'Audiovisuel - Spectacle', 'Audit, gestion' => 'Audit, gestion', 'Automobile' => 'Automobile', 'Banque, assurance' => 'Banque, assurance', 'Bois (filière)' => 'Bois (filière)', 'BTP, architecture' => 'BTP, architecture', 'Chimie, pharmacie' => 'Chimie, pharmacie', 'Commerce, distribution' => 'Commerce, distribution', 'Communication - Marketing, publicité' => 'Communication - Marketing, publicité', 'Construction aéronautique, ferroviaire et navale' => 'Construction aéronautique, ferroviaire et navale', 'Culture - Artisanat d\'art' => 'Culture - Artisanat d\'art', 'Droit, justice' => 'Droit, justice', 'Edition, Journalisme' => 'Edition, Journalisme', 'Électronique' => 'Électronique', 'Énergie' => 'Énergie', 'Enseignement' => 'Enseignement', 'Environnement' => 'Environnement', 'Fonction publique' => 'Fonction publique', 'Hôtellerie, restauration' => 'Hôtellerie, restauration', 'Industrie alimentaire' => 'Industrie alimentaire', 'Informatique, internet et télécom' => 'Informatique, internet et télécom', 'Logistique, transport' => 'Logistique, transport', 'Maintenance, entretien' => 'Maintenance, entretien', 'Mécanique' => 'Mécanique', 'Mode et industrie textile' => 'Mode et industrie textile', 'Recherche' => 'Recherche', 'Santé' => 'Santé', 'Social' => 'Social', 'Sport, loisirs – Tourisme' => 'Sport, loisirs – Tourisme', 'Traduction - interprétariat' => 'Traduction - interprétariat'), 'required' => false, 'mapped' => true))->add('promotion', 'birthday', array('widget' => 'choice', 'years' => range(date('Y') - 110, date('Y')), 'empty_value' => array('year' => '----')));
}
示例10: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('Notas', null, array('label' => 'Notas', 'required' => false))->add('Usuario', 'Symfony\\Bridge\\Doctrine\\Form\\Type\\EntityType', array('label' => 'Encargado', 'choice_label' => 'NombreVisible', 'attr' => array('class' => 'tapir-input-320'), 'class' => 'Yacare\\BaseBundle\\Entity\\Persona', 'query_builder' => function (\Yacare\BaseBundle\Entity\PersonaRepository $er) {
return $er->ObtenerQueryBuilderPorRol('ROLE_REQUERIMIENTOS_ENCARGADO');
}))->add('Requerimiento', 'Tapir\\FormBundle\\Form\\Type\\EntityHiddenType', array('class' => 'Yacare\\RequerimientosBundle\\Entity\\Requerimiento'));
}
示例11: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('username', 'text', ['label' => 'Username', 'required' => true, 'attr' => ['title' => 'Username must be at least 4 characters long and can only contain letters, numbers, and underscores.'], 'constraints' => [new NotBlank()], 'error_type' => 'inline'])->add('plainPassword', 'password', ['label' => 'Password', 'required' => true, 'attr' => ['title' => 'Password must be at least 8 characters long'], 'error_type' => 'inline', 'validation_groups' => ['Registration']])->add('email', 'repeated', ['type' => 'email', 'first_options' => ['label' => 'E-mail'], 'second_options' => ['label' => 'Confirm E-mail'], 'invalid_message' => 'E-mail and Confirm E-mail do not match', 'required' => true, 'constraints' => [new NotBlank(), new Email()], 'error_type' => 'inline']);
/** @var $property ProfileProperty */
foreach ($this->propertyRefs as $property) {
$extra = [];
if ($property->getName() == 'BirthDay') {
$extra = ['title' => 'Must be 18 years old or older', 'constraints' => [new Birthday()]];
}
$property->createFormElement($builder, false, $extra);
}
/*
->add('firstName', null, ['label' => 'First Name', 'required' => true, 'mapped' => false])
->add('lastName', null, ['label' => 'Last Name', 'required' => true, 'mapped' => false])
->add('birthday', 'date', [
'label' => 'Birthday',
'years' => range(date('Y') - 10, date('Y') - 100),
'mapped' => false,
])
->add('country', 'country', ['preferred_choices' => ['US'], 'mapped' => false])
->add('preferredLanguage', 'choice', [
'label' => 'Language',
'choices' => ['en' => 'English', 'es' => 'Spanish', 'pt' => 'Portuguese'],
'required' => true,
'mapped' => false,
])
;
*/
}
示例12: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('Notas', null, array('label' => 'Notas', 'required' => false))->add('Usuario', 'entity', array('label' => 'Encargado', 'property' => 'NombreVisible', 'class' => 'Yacare\\BaseBundle\\Entity\\Persona', 'query_builder' => function (\Yacare\BaseBundle\Entity\PersonaRepository $er) {
return $er->ObtenerQueryBuilderPorRol('ROLE_REQUERIMIENTOS_ENCARGADO');
}))->add('Requerimiento', 'entity_hidden', array('class' => 'Yacare\\RequerimientosBundle\\Entity\\Requerimiento'));
}
示例13: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('Nombre', null, array('label' => 'Nombre', 'required' => true))->add('Obs', null, array('label' => 'Obs.', 'required' => false))->add('Encargado', 'entity', array('label' => 'Encargado predet.', 'property' => 'NombreVisible', 'class' => 'Yacare\\BaseBundle\\Entity\\Persona', 'query_builder' => function (\Yacare\BaseBundle\Entity\PersonaRepository $er) {
return $er->ObtenerQueryBuilderPorRol('ROLE_REQUERIMIENTOS_ENCARGADO');
}, 'required' => false))->add('PermiteAnonimos', new \Tapir\BaseBundle\Form\Type\SiNoType(), array('label' => 'Admite anónimos', 'required' => true));
}
示例14: 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()
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('url', 'urlchooser', array('required' => true));
$builder->add('text', 'text', array('required' => true));
$builder->add('openInNewWindow', 'checkbox', array('required' => false));
}
示例15: buildForm
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('intTypeOfPerson', 'choice', array('choices' => LenderCreator::GetTypesOfPersonToDropDown(), 'expanded' => true, 'multiple' => false, 'data' => $this->getUser()->getTypeOfPerson()));
/**
* LEWA STRONA
*/
$builder->add('strFirstNameNatural', 'text', array('required' => false, 'attr' => array('placeholder' => 'Imię', 'data-required' => 'true')));
$builder->add('strSecondNameNatural', 'text', array('required' => false, 'attr' => array('placeholder' => 'Drugie imię', 'data-required' => 'false')));
$builder->add('strLastNameNatural', 'text', array('required' => false, 'attr' => array('placeholder' => 'Nazwisko', 'data-required' => 'true')));
$builder->add('strPeselNatural', 'text', array('required' => false, 'attr' => array('placeholder' => 'PESEL', 'data-required' => 'true')));
$builder->add('strIdNumberNatural', 'text', array('required' => false, 'attr' => array('placeholder' => 'Nr dowodu osobistego', 'data-required' => 'true')));
$builder->add('strAddressNatural', 'text', array('required' => false, 'attr' => array('placeholder' => 'Adres zamieszkania', 'data-required' => 'true')));
$builder->add('strPostCodeNatural', 'text', array('required' => false, 'attr' => array('placeholder' => 'Kod pocztowy', 'data-required' => 'true')));
$builder->add('strCityNatural', 'text', array('required' => false, 'attr' => array('placeholder' => 'Miescowość', 'data-required' => 'true')));
$builder->add('strPhoneNatural', 'text', array('required' => false, 'attr' => array('placeholder' => 'Telefon', 'data-required' => 'true')));
/**
* PRAWA STRONA
*/
$builder->add('strNameOfCorporationLegal', 'text', array('required' => false, 'attr' => array('placeholder' => 'Nazwa firmy', 'data-required' => 'true')));
$builder->add('strRepresentativeLegal', 'text', array('required' => false, 'attr' => array('placeholder' => 'Reprezentant', 'data-required' => 'true')));
$builder->add('strKrsOrEdgLegal', 'text', array('required' => false, 'attr' => array('placeholder' => 'KRS lub nr wpisu EDG', 'data-required' => 'true')));
$builder->add('strNipLegal', 'text', array('required' => false, 'attr' => array('placeholder' => 'NIP', 'data-required' => 'true')));
$builder->add('strRegonLegal', 'text', array('required' => false, 'attr' => array('placeholder' => 'REGON', 'data-required' => 'true')));
$builder->add('strAddressLegal', 'text', array('required' => false, 'attr' => array('placeholder' => 'Adres siedziby', 'data-required' => 'true')));
$builder->add('strPostCodeLegal', 'text', array('required' => false, 'attr' => array('placeholder' => 'Kod pocztowy', 'data-required' => 'true')));
$builder->add('strCityLegal', 'text', array('required' => false, 'attr' => array('placeholder' => 'Miescowość', 'data-required' => 'true')));
$builder->add('strPhoneLegal', 'text', array('required' => false, 'attr' => array('placeholder' => 'Telefon', 'data-required' => 'true')));
$builder->add('username', 'text', array('attr' => array('placeholder' => 'nick'), 'data' => $this->getUser()->getUsername()));
$builder->add('email', 'text', array('attr' => array('placeholder' => 'e-mail'), 'data' => $this->getUser()->getEmail()));
$builder->add('password', 'password', array('attr' => array('placeholder' => 'hasło')));
$this->setDefault($builder);
}