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'); }
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'))); }
/** * {@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]); }
/** * {@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')); } }
/** * @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')); }
/** * 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')); }
/** * @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' => 'Заказать')); }
/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $person = $this->person; $clientId = $this->clientId; $receiversConfig = array('label' => 'Receivers', 'ajax_choice_attr' => array('filter' => array('route' => 'lc_dev_broadcasts_grid_receivers_filter', 'search_prop' => 'username', 'extra_form_prop' => array('client_id' => 'client_id')), 'selected' => array('route' => 'lc_dev_broadcasts_grid_receivers', 'extra_form_prop' => array('person_id' => 'receivers', 'client_id' => 'client_id')), 'property_value' => 'id', 'property_text' => 'fullNameOrUsername', 'search_prop_label' => 'dev.broadcasts.receivers.filter'), 'required' => true, 'empty_data' => null, 'class' => 'PROCERGSLoginCidadaoCoreBundle:Person', 'property' => 'fullNameOrUsername'); $builder->add('category', 'entity', array('required' => true, 'empty_data' => null, 'class' => 'PROCERGS\\LoginCidadao\\NotificationBundle\\Entity\\Category', 'property' => 'name', 'query_builder' => function (CategoryRepository $repository) use($person, $clientId) { return $repository->getOwnedCategoriesQuery($person)->andWhere('c.id = :clientId')->setParameter('clientId', $clientId); })); $builder->add('client_id', 'hidden', array('required' => false, 'mapped' => false, 'data' => $clientId)); $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use(&$receiversConfig, &$person, $clientId) { $entity = $event->getData(); $form = $event->getForm(); $receiversConfig['query_builder'] = function (PersonRepository $repository) use($clientId, &$entity) { $sql = $repository->getFindAuthorizedByClientIdQuery($clientId); if (!empty($entity['receivers'])) { $sql->andWhere('p.id in (:receivers)'); $sql->setParameter('receivers', $entity['receivers']); } return $sql; }; $form->add('receivers', 'ajax_choice', $receiversConfig); }); $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use(&$receiversConfig, &$person, &$clientId) { $entity = $event->getData(); $form = $event->getForm(); $receiversConfig['query_builder'] = function (PersonRepository $repository) { $sql = $repository->createQueryBuilder('u'); $sql->where('1 != 1'); return $sql; }; $form->add('receivers', 'ajax_choice', $receiversConfig); }); }
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, []); }
/** * {@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')); } }
/** * {@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); }); }
/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('firstName', 'text', array('label' => 'open_orchestra_newsletter.form.first_name')); $builder->add('lastName', 'text', array('label' => 'open_orchestra_newsletter.form.last_name')); $builder->add('email', 'email', array('label' => 'open_orchestra_newsletter.form.email')); $builder->add('submit', 'submit', array('label' => 'open_orchestra_base.form.submit', 'attr' => array('class' => 'submit_form'))); }
public function buildForm(FormBuilderInterface $builder, array $options) { $schemaManager = $this->container['db']->getSchemaManager(); foreach ($schemaManager->listTableColumns($this->table) as $column) { // here we try to display nicely database relations w/ foreign keys if (false !== strpos($column->getName(), '_id')) { $table = str_replace('_id', '', $column->getName()); $dataMap = new DataMap($this->container['db'], $schemaManager); $choices = $dataMap->mapForeignKeys($table, $column); if (is_array($choices)) { $column->setType(Type::getType('array')); } } switch ($column->getType()) { case 'Integer': $builder->add($column->getName(), 'integer', array('read_only' => $column->getName() === 'id' ? true : false, 'required' => $column->getNotNull())); break; case 'Array': $builder->add($column->getName(), 'choice', array('choices' => $choices, 'required' => $column->getNotNull())); break; case 'Boolean': $builder->add($column->getName(), 'checkbox', array('required' => false)); break; case 'String': $builder->add($column->getName(), 'text', array('required' => $column->getNotNull())); break; case 'Text': $builder->add($column->getName(), 'textarea', array('required' => $column->getNotNull())); break; } } }
/** * {@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')); }
/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $configModel = $options['config_model']; $data = array(); if ($configModel instanceof FieldConfigModel) { $className = $configModel->getEntity()->getClassName(); $fieldName = $configModel->getFieldName(); $fieldType = $configModel->getType(); $configType = PropertyConfigContainer::TYPE_FIELD; /** * Add read only field name and field type */ $builder->add('fieldName', 'text', array('label' => 'oro.entity_config.form.name.label', 'block' => 'general', 'disabled' => true, 'data' => $fieldName)); $builder->add('type', 'choice', array('label' => 'oro.entity_config.form.type.label', 'choices' => [], 'block' => 'general', 'disabled' => true, 'empty_value' => 'oro.entity_extend.form.data_type.' . $fieldType)); } else { $className = $configModel->getClassName(); $fieldName = null; $fieldType = null; $configType = PropertyConfigContainer::TYPE_ENTITY; } foreach ($this->configManager->getProviders() as $provider) { if ($provider->getPropertyConfig()->hasForm($configType, $fieldType)) { $config = $this->configManager->getConfig($provider->getId($className, $fieldName, $fieldType)); $builder->add($provider->getScope(), new ConfigScopeType($provider->getPropertyConfig()->getFormItems($configType, $fieldType), $config, $this->configManager, $configModel), array('block_config' => $this->getFormBlockConfig($provider, $configType))); $data[$provider->getScope()] = $config->all(); } } $builder->setData($data); $builder->addEventSubscriber(new ConfigSubscriber($this->doctrine, $this->configManager, $this->translator, $this->dbTranslationMetadataCache)); }
public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('name', 'text', array('label' => 'name', 'disabled' => true)); $builder->add('newIcon', 'file', array('required' => false, 'mapped' => false, 'label' => 'icon')); $builder->add('creationDate', 'date', array('disabled' => true, 'widget' => 'single_text', 'format' => 'yyyy-MM-dd', 'label' => 'creation_date')); $builder->add('creator', 'text', array('data' => $this->creator, 'mapped' => false, 'disabled' => true, 'label' => 'creator')); }
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')); }
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"))); }
/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->addEventSubscriber(new CleanFormSubscriber()); $builder->add('name', 'text', array('label' => 'mautic.chat.channel.form.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'maxlength' => 25, 'preaddon' => 'symbol-hashtag'))); $builder->add('description', 'text', array('label' => 'mautic.chat.channel.form.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'maxlength' => 150), 'required' => false)); /* $builder->add('isPrivate', 'button_group', array( 'choice_list' => new ChoiceList( array(false, true), array('mautic.core.form.no', 'mautic.core.form.yes') ), 'expanded' => true, 'multiple' => false, 'empty_value' => false, 'required' => false 'label_attr' => array('class' => 'control-label'), 'label' => 'mautic.chat.channel.form.isprivate', 'empty_value' => false, 'required' => false )); $builder->add('privateUsers', 'collection', array( 'allow_add' => true, 'by_reference' => false, 'prototype' => true )); */ $builder->add('buttons', 'form_buttons', array('apply_text' => false, 'save_text' => 'mautic.core.form.save', 'container_class' => 'chat-channel-buttons')); if (!empty($options["action"])) { $builder->setAction($options["action"]); } }
public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('login', 'text', ['label' => 'Login', 'required' => true, 'disabled' => $options['disabled'], 'constraints' => [new Assert\NotBlank()]]); $builder->add('password', 'password', ['label' => 'Password', 'required' => true, 'disabled' => $options['disabled'], 'constraints' => [new Assert\NotBlank()]]); $builder->add('remember-me', 'checkbox', ['label' => 'Remember me', 'mapped' => false, 'required' => false, 'attr' => ['checked' => 'checked', 'value' => '1']]); $builder->add('redirect', 'hidden', ['required' => false]); }
public function buildForm(FormBuilderInterface $builder, array $options) { $allowAllMethods = !count($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, 'data' => $options['default_method'])); 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->addEventListener(FormEvents::POST_BIND, function ($form) use($self, $options) { $self->validate($form, $options); }); $builder->addModelTransformer(new CallbackTransformer(function ($data) use($self, $options) { return $self->transform($data, $options); }, function ($data) use($self, $options) { return $self->reverseTransform($data, $options); }), true); }
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')); }
/** * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options * @author Eric Haynes */ public function buildForm(FormBuilderInterface $builder, array $options) { $site = $this->site; $application = $this->application; $builder->add('sale_price', 'money', array('label' => 'Sale Price', 'currency' => 'USD', 'required' => true, 'precision' => 2, 'grouping' => true, 'attr' => array('class' => 'span2')))->add('loan_amount', 'money', array('label' => 'Loan Amount', 'currency' => 'USD', 'required' => true, 'precision' => 2, 'grouping' => true, 'attr' => array('class' => 'span2')))->add('loan_term', 'number', array('label' => 'Term (Years)', 'required' => true, 'attr' => array('class' => 'span1', 'maxlength' => 2)))->add('loan_type', 'choice', array('choices' => $application->loanTypes, 'empty_value' => 'Please select one'))->add('loan_purpose', 'choice', array('label' => 'Which type of loan are you applying for?', 'multiple' => false, 'choices' => $application->loanPurposes, 'expanded' => true, 'multiple' => false))->add('status', 'choice', array('label' => 'Loan Status', 'choices' => $application->loanStatuses))->add('num_units', 'number', array('label' => 'Number of Units', 'required' => true, 'attr' => array('class' => 'span1')))->add('property_type', 'choice', array('choices' => $application->propertyTypes, 'empty_value' => 'Please select one'))->add('property_year_built', 'text', array('label' => 'Year Built', 'required' => false, 'attr' => array('class' => 'span2', 'maxlength' => 4)))->add('residency_type', 'choice', array('choices' => $application->residencyTypes, 'empty_value' => 'Please select one'))->add('title_company1', 'text', array('label' => 'Name #1', 'required' => false))->add('title_company2', 'text', array('label' => 'Name #2', 'required' => false))->add('has_realtor', 'choice', array('label' => 'Are you currently working with a Realtor?', 'choices' => array(0 => 'No', 1 => 'Yes'), 'multiple' => false, 'expanded' => true))->add('is_lennar_home', 'choice', array('label' => 'Is this a lennar home?', 'choices' => array(false => 'No', true => 'Yes'), 'multiple' => false, 'expanded' => true))->add('lennar_community_name', 'text', array('label' => 'Community Name?', 'required' => false))->add('lennar_builder_name', 'text', array('label' => 'Builder Name?', 'required' => false))->add('need_to_sell', 'choice', array('required' => false, 'label' => 'Do you need to sell home?', 'choices' => array(1 => 'Yes', 2 => 'No'), 'multiple' => false, 'expanded' => true))->add('property_location', new PropertyLocationType($site), array('validation_groups' => array('step2')))->add('realtor_name', 'text', array('attr' => array('class' => 'realtor-info-field')))->add('realtor_company', 'text', array('attr' => array('class' => 'realtor-info-field')))->add('realtor_phone', 'text', array('attr' => array('class' => 'realtor-info-field phonenumber')))->add('borrower', new EagleBorrowerType())->add('co_borrower', 'collection', array('type' => new EagleBorrowerType(), 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => false))->add('asset_account', 'collection', array('type' => new EagleAssetAccountType($this->application->getId()), 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => false))->add('asset_real_estate', 'collection', array('type' => new EagleAssetRealEstateType($this->application->getId()), 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => false))->add('income_other', 'collection', array('type' => new EagleIncomeOtherType($this->application->getId()), 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => false))->add('income_monthly', 'collection', array('type' => new EagleIncomeMonthlyType($this->application->getId()), 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => false))->add('agreement_one', 'checkbox', array('required' => true))->add('agreement_two', 'checkbox', array('required' => true))->add('agreement_three', 'checkbox', array('required' => true))->add('expense_housing', new ExpenseHousingType())->add('comments', 'textarea', array('attr' => array('class' => 'span3'), 'required' => false))->add('loan_officer', 'entity', array('label' => 'Are you working with a loan officer?', 'class' => 'SudouxMortgageBundle:LoanOfficer', 'property' => 'fullname', 'multiple' => false, 'empty_value' => 'Select a loan officer', 'required' => false, 'query_builder' => function (EntityRepository $er) use($site) { return $er->findAllBySiteType($site); }))->add('refinance_year_acquired', 'number', array('label' => 'Year Acquired', 'required' => true, 'attr' => array('class' => 'span1', 'maxlength' => 4)))->add('refinance_original_cost', 'money', array('label' => 'Original Cost', 'currency' => 'USD', 'required' => true, 'precision' => 2, 'grouping' => true, 'attr' => array('class' => 'span2')))->add('refinance_existing_liens', 'money', array('label' => 'Existing Liens', 'currency' => 'USD', 'required' => true, 'precision' => 2, 'grouping' => true, 'attr' => array('class' => 'span2')))->add('refinance_current_rate', 'text', array('label' => 'Current Rate', 'required' => true, 'attr' => array('class' => 'span1')))->add('refinance_current_loan_type', 'text', array('label' => 'Current Loan Type', 'required' => true, 'attr' => array('class' => 'span3')))->add('refinance_current_lender', 'text', array('label' => 'Current Lender', 'required' => true, 'attr' => array('class' => 'span3')))->add('refinance_purpose', 'choice', array('label' => 'Purpose of Refinance', 'choices' => $application->refinancePurposes, 'required' => true, 'empty_value' => 'Please select one'))->add('referral_source', 'entity', array('class' => 'Sudoux\\Cms\\FormBundle\\Entity\\ReferralSource', 'property' => 'name', 'required' => false, 'multiple' => true, 'expanded' => true, 'label' => 'Where did you hear about us?', 'attr' => array('class' => 'checkbox-group'), 'query_builder' => function (EntityRepository $er) use($site) { return $er->findAllActiveBySiteQuery($site); }))->add('no_property_location', 'checkbox', array('label' => 'I do not have a property yet', 'attr' => array('class' => ''), 'required' => false)); $titleManner = $this->application->getTitleManner(); if (isset($titleManner)) { $builder->add('title_manner', 'text', array('label' => 'Manner', 'required' => false)); } else { $builder->add('title_manner', 'choice', array('label' => 'Manner', 'required' => false, 'choices' => $application->titleManners, 'empty_value' => 'Please select one', 'required' => false)); } /*$group = $application->getMilestoneGroup(); if(isset($group)) { $builder->add('milestone', 'entity', array( 'label' => 'Loan Status', 'class' => 'SudouxMortgageBundle:LoanMilestone', 'property' => 'name', 'multiple' => false, 'empty_value' => 'Select a status', 'required' => false, 'query_builder' => function(EntityRepository $er) use ($group) { return $er->findByMilestoneGroupQuery($group->getId()); } )); }*/ }
public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('name', TextType::class, array('attr' => array('class' => 'form-control'), 'label' => 'name', 'translation_domain' => 'messages')); $builder->add('description', TextType::class, array('attr' => array('class' => 'form-control'), 'label' => 'description', 'translation_domain' => 'messages', 'required' => false)); $builder->add('language', EntityType::class, array('class' => 'MagicWordBundle:Language', 'choice_label' => 'name', 'label' => 'language', 'translation_domain' => 'messages', 'choice_translation_domain' => 'messages', 'attr' => array('class' => 'form-control'))); $builder->add('save', SubmitType::class, array('attr' => array('class' => 'btn btn-default'), 'label' => 'save', 'translation_domain' => 'messages')); }
public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('visible', 'choice', array('choices' => array('yes' => true, 'no' => false), 'label' => 'visible', 'required' => 'false', 'choices_as_values' => true)); if ($this->withLock) { $builder->add('locked', 'checkbox', array('label' => 'locked')); } }
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]); }
/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('title')->add('description')->add('image', AdvertImageType::class, array('required' => false))->add('removeImage', HiddenType::class, array('attr' => array('class' => 'remove-image'))); if (isset($options['admin'])) { $builder->add('active'); } }
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'); }
/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { /* @var $Product \Eccube\Entity\Product */ $Product = $options['product']; $this->Product = $Product; $ProductClasses = $Product->getProductClasses(); $builder->add('mode', 'hidden', array('data' => 'add_cart'))->add('product_id', 'hidden', array('data' => $Product->getId(), 'constraints' => array(new Assert\NotBlank(), new Assert\Regex(array('pattern' => '/^\\d+$/')))))->add('product_class_id', 'hidden', array('data' => count($ProductClasses) === 1 ? $ProductClasses[0]->getId() : '', 'constraints' => array(new Assert\Regex(array('pattern' => '/^\\d+$/')))))->addEventSubscriber(new \Eccube\Event\FormEventSubscriber()); if ($Product->getStockFind()) { $builder->add('quantity', 'integer', array('data' => 1, 'attr' => array('min' => 1, 'maxlength' => $this->config['int_len']), 'constraints' => array(new Assert\NotBlank(), new Assert\GreaterThanOrEqual(array('value' => 1)), new Assert\Regex(array('pattern' => '/^\\d+$/'))))); if ($Product && $Product->getProductClasses()) { if ($Product->getClassName1()) { $builder->add('classcategory_id1', 'choice', array('label' => $Product->getClassName1(), 'choices' => array('__unselected' => '選択してください') + $Product->getClassCategories1())); } if ($Product->getClassName2()) { $builder->add('classcategory_id2', 'choice', array('label' => $Product->getClassName2(), 'choices' => array('__unselected' => '選択してください'))); } } $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use($Product) { $data = $event->getData(); $form = $event->getForm(); if ($Product->getClassName2()) { if ($data['classcategory_id1']) { $form->add('classcategory_id2', 'choice', array('label' => $Product->getClassName2(), 'choices' => array('__unselected' => '選択してください') + $Product->getClassCategories2($data['classcategory_id1']))); } } }); } }
public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('order_status', 'entity', array('class' => 'Club\\ShopBundle\\Entity\\OrderStatus', 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('os')->orderBy('os.priority', 'ASC'); })); $builder->add('note'); }