PHP symfony\component\form FormBuilderInterface Examples

PHP symfony\component\form FormBuilderInterface - 30 examples found. These are the top rated real world PHP examples of symfony\component\form\FormBuilderInterface extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
1
 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('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'));
     }
 }
Example #4
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $transformer = new ManyRelatedTransformer($this->doctrineRegistry, $options['entityName']);
     $viewTransformer = new ArrayToStringTransformer();
     $builder->addModelTransformer($transformer);
     $builder->addViewTransformer($viewTransformer);
 }
Example #5
0
 /**
  * @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'));
 }
Example #6
0
 /**
  * @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' => 'Заказать'));
 }
Example #7
0
 /**
  * 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()
  *
  * @return void
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $folder = $options['folder'];
     $builder->add('name', null, array('label' => 'media.folder.addsub.form.name'))->add('rel', ChoiceType::class, array('choices' => array('media' => 'media', 'image' => 'image', 'slideshow' => 'slideshow', 'video' => 'video'), 'choices_as_values' => true, 'label' => 'media.folder.addsub.form.rel'))->add('parent', EntityType::class, array('class' => 'KunstmaanMediaBundle:Folder', 'choice_label' => 'optionLabel', 'label' => 'media.folder.addsub.form.parent', 'required' => true, 'query_builder' => function (FolderRepository $er) use($folder) {
         return $er->selectFolderQueryBuilder($folder);
     }))->add('internalName', TextType::class, array('label' => 'media.folder.addsub.form.internal_name', 'required' => false));
 }
 /**
  * {@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]);
 }
 /**
  * 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'));
 }
Example #10
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->setRequired($options['required'])->setDisabled($options['disabled'])->setErrorBubbling($options['error_bubbling'])->setEmptyData($options['empty_data'])->setPropertyPath($options['property_path'])->setMapped($options['mapped'])->setByReference($options['by_reference'])->setVirtual($options['virtual'])->setCompound($options['compound'])->setData(isset($options['data']) ? $options['data'] : null)->setDataLocked(isset($options['data']))->setDataMapper($options['compound'] ? new PropertyPathMapper($this->propertyAccessor) : null);
     if ($options['trim']) {
         $builder->addEventSubscriber(new TrimListener());
     }
 }
Example #11
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $type = $builder->getData()->getNode()->getType();
     if (isset($this->nodeExtensions[$type])) {
         $this->nodeExtensions[$type]->buildForm($builder, $options);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addModelTransformer($this->denormalizedEntityTransformer);
     $this->tagManager->setLocale($options['locale']);
     // On Pre-Submit, create the news posted Tags otherwise the form won't be valid
     $builder->addEventListener(FormEvents::PRE_SUBMIT, function ($event) use($options) {
         // Data when posted
         $tags = $event->getData();
         $entity = $event->getForm()->getParent()->getData();
         // Loop through the posted tags (if not numeric, it's a news Tag)
         if (is_array($tags)) {
             foreach ($tags as $key => $tagId) {
                 if (!is_numeric($tagId)) {
                     $tag = $this->tagManager->loadOrCreateTag($tagId, $options['use_global_tags'] ? null : $entity->getResourceType());
                     $tags[$key] = $tag->getId();
                     $entity->setTagsUpdatedAt(new \DateTime());
                 }
             }
             // Update the posted data with the newly created tags
             $event->setData($tags);
             $this->taggableListener->setNeedToFlush(true);
         } elseif (null === $tags && count($entity->getTags())) {
             // All tags are removed
             $this->taggableListener->setNeedToFlush(true);
         }
     }, 900);
 }
Example #13
0
 /**
  * Adds a CSRF field to the form when the CSRF protection is enabled.
  *
  * @param FormBuilderInterface $builder The form builder
  * @param array                $options The options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if (!$options['csrf_protection']) {
         return;
     }
     $builder->addEventSubscriber(new CsrfValidationListener($options['csrf_field_name'], $options['csrf_token_manager'], $options['csrf_token_id'] ?: ($builder->getName() ?: get_class($builder->getType()->getInnerType())), $options['csrf_message'], $this->translator, $this->translationDomain));
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $deliveries = $options['deliveries'];
     $delivery = $options['delivery'];
     $deliveryDates = $options['deliveryDates'];
     $builder->add('delivery', 'entity', array('class' => 'Eccube\\Entity\\Delivery', 'property' => 'name', 'choices' => $deliveries, 'data' => $delivery))->add('deliveryDate', 'choice', array('choices' => $deliveryDates, 'required' => false, 'empty_value' => '指定なし'))->add('deliveryTime', 'entity', array('class' => 'Eccube\\Entity\\DeliveryTime', 'property' => 'deliveryTime', 'choices' => $delivery->getDeliveryTimes(), 'required' => false, 'empty_value' => '指定なし', 'empty_data' => null))->addEventSubscriber(new \Eccube\Event\FormEventSubscriber());
 }
 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, []);
 }
Example #16
0
 /**
  * Determine, if form is in editing mode
  *
  * @param \Symfony\Component\Form\FormBuilderInterface $builder
  *
  * @return bool
  */
 protected function _getIsEditMode(FormBuilderInterface $builder)
 {
     if (!$builder->getData()->getId()) {
         return false;
     }
     return true;
 }
Example #17
0
 /**
  * @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);
     });
 }
Example #18
0
 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');
 }
 /**
  * @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());
     				}
     			));
     		}*/
 }
Example #20
0
 /**
  * {@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)
 {
     if ($this->noThrow !== true) {
         throw new \RuntimeException(__CLASS__ . " require contruction");
     }
     $builder->add('a', null, array('description' => 'A nice description'));
 }
Example #22
0
/**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('contenu','textarea')
            ->add('date', 'datetime')  ->add('valider', 'submit')
                    ;
    }
 /**
  * {@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'));
 }
Example #24
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $hotelId = $this->hotelId;
     $builder->add('hotel', 'entity', array('class' => 'KvartiriBundle:Hotels', 'query_builder' => function (EntityRepository $er) use($hotelId) {
         return $er->createQueryBuilder('hotel')->where('hotel.id = ?1')->setParameter(1, $hotelId);
     }))->add('promotionEarlyBooking', 'collection', array('type' => new PromotionEarlyBookingType(), 'allow_add' => true, 'allow_delete' => true))->add('promotionFixedDates', 'collection', array('type' => new PromotionFixedDatesType(), 'allow_add' => true, 'allow_delete' => true))->add('promotionGroup', 'collection', array('type' => new PromotionGroupType(), 'allow_add' => true, 'allow_delete' => true))->add('promotionMoreNights', 'collection', array('type' => new PromotionMoreNightsType(), 'allow_add' => true, 'allow_delete' => true))->add('promotionPeriod', 'collection', array('type' => new PromotionPeriodType(), 'allow_add' => true, 'allow_delete' => true))->add('reductionChildren', 'collection', array('type' => new ReductionChildrenType(), 'allow_add' => true, 'allow_delete' => true));
 }
Example #25
0
 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'));
 }
Example #26
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $transformer = new MenuGroupTransformer($this->menuManager, 'menugroup');
     $builder->add('menugroup', 'entity', ['class' => $this->menuGroupClass, 'query_builder' => function ($er) {
         return $er->createQueryBuilder('d');
     }, 'property' => 'indentedName', 'empty_value' => '/', 'required' => false, 'empty_data' => null, 'label' => false])->addModelTransformer($transformer);
 }
Example #27
0
 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'));
 }
Example #28
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if (!$options['sortable']) {
         return;
     }
     $builder->add('_position', 'hidden', ['property_path' => $options['sortable_property_path'], 'data' => '0', 'attr' => ['class' => 'position-input']]);
 }
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $numTrabajadores = array();
     $i = 1;
     while ($i <= 10) {
         $numTrabajadores[$i] = $i;
         $i++;
     }
     $builder->add('fecha', 'date', array('label' => 'Fecha', 'input' => 'datetime', 'widget' => 'choice', 'format' => 'ddMMyyyy', 'disabled' => true))->add('tipoDeHallazgo', 'choice', array('choices' => array('CONDUCTUALES', 'ADMINISTRATIVOS', 'N/A')))->add('hora', 'time', array('label' => 'Hora', 'disabled' => true))->add('lugarDeTrabajo', 'text', array('label' => 'Lugar de trabajo', 'disabled' => true))->add('numDeEmpleados', 'choice', array('label' => 'Nº de empleados', 'choices' => $numTrabajadores, 'disabled' => true))->add('cttaSubcont')->add('observaciones', 'textarea', array('label' => 'Observaciones', 'disabled' => true))->add('respuesta11', new SurveyType(), array('label' => 'respuesta1.1_peru_electrica', 'disabled' => true))->add('respuesta12', new SurveyType(), array('label' => 'respuesta1.2_peru_electrica', 'disabled' => true))->add('respuesta13', new SurveyType(), array('label' => 'respuesta1.3_peru_electrica', 'disabled' => true))->add('respuesta14', new SurveyType(), array('label' => 'respuesta1.4_peru_electrica', 'disabled' => true))->add('respuesta15', new SurveyType(), array('label' => 'respuesta1.5_peru_electrica', 'disabled' => true))->add('respuesta21', new SurveyType(), array('label' => 'respuesta2.1_peru_electrica', 'disabled' => true))->add('respuesta22', new SurveyType(), array('label' => 'respuesta2.2_peru_electrica', 'disabled' => true))->add('respuesta23', new SurveyType(), array('label' => 'respuesta2.3_peru_electrica', 'disabled' => true))->add('respuesta31', new SurveyType(), array('label' => 'respuesta3.1_peru_electrica', 'disabled' => true))->add('respuesta32', new SurveyType(), array('label' => 'respuesta3.2_peru_electrica', 'disabled' => true))->add('respuesta33', new SurveyType(), array('label' => 'respuesta3.3_peru_electrica', 'disabled' => true))->add('respuesta34', new SurveyType(), array('label' => 'respuesta3.4_peru_electrica', 'disabled' => true))->add('respuesta35', new SurveyType(), array('label' => 'respuesta3.5_peru_electrica', 'disabled' => true))->add('respuesta41', new SurveyType(), array('label' => 'respuesta4.1_peru_electrica', 'disabled' => true))->add('respuesta42', new SurveyType(), array('label' => 'respuesta4.2_peru_electrica', 'disabled' => true))->add('respuesta43', new SurveyType(), array('label' => 'respuesta4.3_peru_electrica', 'disabled' => true))->add('respuesta44', new SurveyType(), array('label' => 'respuesta4.4_peru_electrica', 'disabled' => true))->add('respuesta45', new SurveyType(), array('label' => 'respuesta4.5_peru_electrica', 'disabled' => true))->add('respuesta46', new SurveyType(), array('label' => 'respuesta4.6_peru_electrica', 'disabled' => true))->add('respuesta47', new SurveyType(), array('label' => 'respuesta4.7_peru_electrica', 'disabled' => true))->add('respuesta48', new SurveyType(), array('label' => 'respuesta4.8_peru_electrica', 'disabled' => true))->add('respuesta49', new SurveyType(), array('label' => 'respuesta4.9_peru_electrica', 'disabled' => true))->add('respuesta410', new SurveyType(), array('label' => 'respuesta4.10_peru_electrica', 'disabled' => true))->add('respuesta411', new SurveyType(), array('label' => 'respuesta4.11_peru_electrica', 'disabled' => true))->add('respuesta412', new SurveyType(), array('label' => 'respuesta4.12_peru_electrica', 'disabled' => true))->add('respuesta51', new SurveyType(), array('label' => 'respuesta5.1_peru_electrica', 'disabled' => true))->add('respuesta52', new SurveyType(), array('label' => 'respuesta5.2_peru_electrica', 'disabled' => true))->add('respuesta53', new SurveyType(), array('label' => 'respuesta5.3_peru_electrica', 'disabled' => true))->add('respuesta61', new SurveyType(), array('label' => 'respuesta6.1_peru_electrica', 'disabled' => true))->add('respuesta62', new SurveyType(), array('label' => 'respuesta6.2_peru_electrica', 'disabled' => true))->add('respuesta63', new SurveyType(), array('label' => 'respuesta6.3_peru_electrica', 'disabled' => true))->add('respuesta64', new SurveyType(), array('label' => 'respuesta6.4_peru_electrica', 'disabled' => true))->add('respuesta71', new SurveyType(), array('label' => 'respuesta7.1_peru_electrica', 'disabled' => true))->add('respuesta72', new SurveyType(), array('label' => 'respuesta7.2_peru_electrica', 'disabled' => true))->add('respuesta81', new SurveyType(), array('label' => 'respuesta8.1_peru_electrica', 'disabled' => true))->add('respuesta82', new SurveyType(), array('label' => 'respuesta8.2_peru_electrica', 'disabled' => true))->add('respuesta91', new SurveyType(), array('label' => 'respuesta9.1_peru_electrica', 'disabled' => true))->add('respuesta92', new SurveyType(), array('label' => 'respuesta9.2_peru_electrica', 'disabled' => true))->add('respuesta93', new SurveyType(), array('label' => 'respuesta9.3_peru_electrica', 'disabled' => true))->add('respuesta101', new SurveyType(), array('label' => 'respuesta10.1_peru_electrica', 'disabled' => true))->add('respuesta102', new SurveyType(), array('label' => 'respuesta10.2_peru_electrica', 'disabled' => true))->add('respuesta103', new SurveyType(), array('label' => 'respuesta10.3_peru_electrica', 'disabled' => true))->add('respuesta111', new SurveyType(), array('label' => 'respuesta11.1_peru_electrica', 'disabled' => true))->add('respuesta121', new SurveyType(), array('label' => 'respuesta12.1_peru_electrica', 'disabled' => true))->add('cierre', 'textarea', array('label' => 'Cierre'))->add('statusCierre', 'hidden')->add('uploadedFileCierre1', 'file', array('label' => 'Adjunto 1', 'required' => false))->add('uploadedFileCierre2', 'file', array('label' => 'Adjunto 2', 'required' => false))->add('uploadedFile1', 'file', array('label' => 'Adjunto 1', 'required' => false, 'disabled' => true))->add('uploadedFile2', 'file', array('label' => 'Adjunto 2', 'required' => false, 'disabled' => true))->add('uploadedFile3', 'file', array('label' => 'Adjunto 3', 'required' => false, 'disabled' => true))->add('visible', 'hidden', array())->add('cierreLog', 'hidden', array())->add('localizacion', 'hidden', array())->add('empresa', 'entity', array('class' => 'BcTicCamIpalBundle:Empresa', 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('r')->where('r.visible = :visible')->setParameter('visible', 1)->orderBy('r.nombre', 'ASC');
     }, 'empty_value' => '-- SELECCIONE EMPRESA --', 'empty_data' => "-1", 'disabled' => true))->add('contrato', 'entity', array('class' => 'BcTicCamIpalBundle:Contrato', 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('r')->where('r.visible = :visible')->setParameter('visible', 1)->orderBy('r.numero', 'ASC');
     }, 'empty_value' => '-- SELECCIONE CONTRATO --', 'empty_data' => "-1", 'disabled' => true))->add('mandante', 'entity', array('label' => 'Mandante', 'class' => 'BcTicCamIpalBundle:Mandante', 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('r')->where('r.visible = :visible')->setParameter('visible', 1)->orderBy('r.name', 'ASC');
     }, 'read_only' => true, 'disabled' => true, 'empty_value' => '-- SERVICIO --', 'empty_data' => -1))->add('inspector', 'text', array('label' => 'Inspector', 'disabled' => true))->add('prevencionista', 'hidden', array('disabled' => true))->add('supervisor', 'entity_hidden', array('class' => 'BcTic\\CamIpalBundle\\Entity\\Empleado'))->add('servicio', 'entity', array('label' => 'Servicio', 'class' => 'BcTicCamIpalBundle:Servicio', 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('r')->where('r.visible = :visible')->setParameter('visible', 1)->orderBy('r.nombre', 'ASC');
     }, 'read_only' => true, 'disabled' => true, 'empty_value' => '-- SERVICIO --', 'empty_data' => -1))->add('area', 'entity', array('label' => 'Área', 'class' => 'BcTicCamIpalBundle:Area', 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('r')->where('r.visible = :visible')->setParameter('visible', 1)->orderBy('r.nombre', 'ASC');
     }, 'read_only' => true, 'disabled' => true, 'empty_value' => '-- AREA --', 'empty_data' => -1))->add('gerencia', 'entity', array('label' => 'Gerencia', 'class' => 'BcTicCamIpalBundle:Gerencia', 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('r')->where('r.visible = :visible')->setParameter('visible', 1)->orderBy('r.nombre', 'ASC');
     }, 'read_only' => true, 'disabled' => true, 'empty_value' => '-- GERENCIA --', 'empty_data' => -1))->add('subGerencia', 'entity', array('label' => 'Sub Gerencia', 'class' => 'BcTicCamIpalBundle:SubGerencia', 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('r')->where('r.visible = :visible')->setParameter('visible', 1)->orderBy('r.nombre', 'ASC');
     }, 'read_only' => true, 'disabled' => true, 'empty_value' => '-- SUB GERENCIA --', 'empty_data' => -1))->add('pais', 'entity', array('label' => 'País', 'class' => 'BcTicCamIpalBundle:Pais', 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('r')->orderBy('r.nombre', 'ASC');
     }, 'read_only' => true, 'disabled' => true))->add('autoInspeccion', 'choice', array('label' => 'Auto Inspección', 'choices' => array('N/A' => 'N/A: No aplica', 'A1' => 'A1', 'A2' => 'A2', 'A3' => 'A3', 'A4' => 'A4')))->add('charlaOperativa', 'choice', array('label' => 'Charla operativa', 'choices' => array('N/A' => 'N/A: No aplica', 'B1' => 'B1', 'B2' => 'B2', 'B3' => 'B3', 'B4' => 'B4')))->add('charlaGrabada', 'choice', array('label' => 'Charla grabada', 'choices' => array('N/A' => 'N/A: No aplica', 'SI' => 'Sí', 'NO' => 'No')));
 }
 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'));
 }