当前位置: 首页>>代码示例>>PHP>>正文


PHP FormBuilderInterface::getData方法代码示例

本文整理汇总了PHP中Symfony\Component\Form\FormBuilderInterface::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilderInterface::getData方法的具体用法?PHP FormBuilderInterface::getData怎么用?PHP FormBuilderInterface::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Form\FormBuilderInterface的用法示例。


在下文中一共展示了FormBuilderInterface::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $id_users = null;
     if ($builder->getData()->getUser() instanceof User) {
         $id_users = $builder->getData()->getUser()->getId();
     }
     //
     if (in_array('ROLE_ADMIN', $this->_roles_user) || in_array('ROLE_SUPER_ADMIN', $this->_roles_user) || in_array('ROLE_CONTENT_MANAGER', $this->_roles_user)) {
         $read_only = false;
     } else {
         $read_only = true;
     }
     $builder->add('enabled', 'checkbox', array('data' => true, 'label' => 'pi.form.label.field.enabled'))->add('user', 'entity', array('class' => 'SfynxAuthBundle:User', 'query_builder' => function (EntityRepository $er) use($id_users) {
         $translatableListener = $this->_container->get('gedmo.listener.translatable');
         $translatableListener->setTranslationFallback(true);
         return $er->createQueryBuilder('a')->select('a')->where("a.id IN (:id)")->andWhere('a.enabled = 1')->setParameter('id', $id_users);
     }, 'empty_value' => 'pi.form.label.select.choose.user', 'label' => "pi.form.label.field.user", 'multiple' => false, 'required' => false, "attr" => array("class" => "pi_simpleselect ajaxselect", "data-url" => $this->_container->get('sfynx.tool.route.factory')->getRoute("users_selectentity_ajax"), "data-selectid" => $id_users, "data-max" => 50)))->add('rubrique', 'entity', array('class' => 'SfynxCmfBundle:Rubrique', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageRubrique();
     }, 'empty_value' => 'Choose an option', 'multiple' => false, 'required' => false, "attr" => array("class" => "pi_simpleselect")))->add('layout', 'entity', array('class' => 'SfynxAuthBundle:Layout', "attr" => array("class" => "pi_simpleselect")))->add('page_css', 'entity', array('class' => 'SfynxCmfBundle:Page', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageCss();
     }, 'property' => 'url', 'multiple' => true, 'required' => false, "attr" => array("class" => "pi_multiselect")))->add('page_js', 'entity', array('class' => 'SfynxCmfBundle:Page', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageJs();
     }, 'property' => 'url', 'multiple' => true, 'required' => false, "attr" => array("class" => "pi_multiselect")))->add('keywords', 'entity', array('class' => 'SfynxCmfBundle:KeyWord', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageKeyWords();
     }, 'multiple' => true, 'required' => false, "attr" => array("class" => "pi_multiselect")))->add('meta_content_type', 'choice', array('choices' => PageRepository::getAvailableContentTypes(), 'required' => true, 'multiple' => false, 'expanded' => true, 'read_only' => true))->add('cacheable', 'checkbox', array('label' => 'pi.page.form.cacheable', 'required' => false, 'help_block' => $this->_container->get('translator')->trans('pi.page.form.field.cacheable')))->add('public', 'checkbox', array('label' => 'pi.page.form.public', 'required' => false, 'help_block' => $this->_container->get('translator')->trans('pi.page.form.field.public')))->add('lifetime', 'number', array('label' => 'pi.page.form.lifetime', 'required' => false, 'help_block' => $this->_container->get('translator')->trans('pi.page.form.field.lifetime')))->add('route_name', 'text', array('label' => 'pi.page.form.route_name'))->add('url', 'text', array('label' => 'pi.page.form.url'))->add('blocks', 'collection', array('allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => true, 'type' => new BlockType(), 'options' => array('attr' => array('class' => 'block_widget')), 'label' => ' '));
 }
开发者ID:pigroupe,项目名称:SfynxCmfBundle,代码行数:26,代码来源:PageByBlockType.php

示例2: buildForm

 /**
  * {@inheritDoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $admin = clone $this->getAdmin($options);
     if ($admin->hasParentFieldDescription()) {
         $admin->getParentFieldDescription()->setAssociationAdmin($admin);
     }
     if ($options['delete'] && $admin->isGranted('DELETE')) {
         if (!array_key_exists('translation_domain', $options['delete_options']['type_options'])) {
             $options['delete_options']['type_options']['translation_domain'] = $admin->getTranslationDomain();
         }
         $builder->add('_delete', $options['delete_options']['type'], $options['delete_options']['type_options']);
     }
     // hack to make sure the subject is correctly set
     // https://github.com/sonata-project/SonataAdminBundle/pull/2076
     if ($builder->getData() === null) {
         $p = new PropertyAccessor(false, true);
         try {
             $subject = $p->getValue($admin->getParentFieldDescription()->getAdmin()->getSubject(), $this->getFieldDescription($options)->getFieldName() . $options['property_path']);
             $builder->setData($subject);
         } catch (NoSuchIndexException $e) {
             // no object here
         }
     }
     $admin->setSubject($builder->getData());
     $admin->defineFormBuilder($builder);
     $builder->addModelTransformer(new ArrayToModelTransformer($admin->getModelManager(), $admin->getClass()));
 }
开发者ID:kwuerl,项目名称:SonataAdminBundle,代码行数:30,代码来源:AdminType.php

示例3: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('ip', null, array('attr' => array('placeholder' => 'e.g 192.168.1.1/16'), 'label' => 'Ip/Mask', 'description' => "The network ip and mask"))->add('networkAdmin', null, array('required' => true, 'empty_value' => 'Choose an admin', 'attr' => array('help_text' => 'This will be the network admin'), 'description' => "The administrator responsible for the network", 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('na')->where('na.isActive = TRUE')->orderBy('na.name', 'ASC');
     }))->add('academicUnit', null, array('required' => true, 'empty_value' => 'Choose a unit', 'attr' => array('help_text' => 'The unit to which the network belongs'), 'description' => "The unit responsible, that owns the network", 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('au')->orderBy('au.name', 'ASC');
     }));
     if ($builder->getData()) {
         if (!$builder->getData()->getIsActive()) {
             $builder->add('reactivate', 'checkbox', array('data' => false, 'mapped' => false, 'label_attr' => array('class' => 'alert alert-warning'), 'attr' => array('align_with_widget' => true, 'help_text' => 'If it set to true the network will be reactivated.'), 'required' => false, 'label' => 'Reactivate?'));
         }
         $builder->add('force_edit', 'checkbox', array('data' => false, 'mapped' => false, 'label_attr' => array('class' => 'alert alert-warning'), 'attr' => array('align_with_widget' => true, 'help_text' => 'If it set to true the network will be edited and not replaced.(this can harm the network history)'), 'required' => false, 'label' => 'Force edit'));
     }
     $builder->add('save', 'submit', array('attr' => array('class' => 'save ladda-button btn-lg btn-block', 'data-style' => "slide-down")));
     $builder->addEventListener(FormEvents::POST_SET_DATA, function (FormEvent $event) {
         $network = $event->getData();
         $form = $event->getForm();
         // check if the Product object is "new"
         // If no data is passed to the form, the data is "null".
         // This should be considered a new "Product"
         if ($network) {
             $form->get('ip')->setData($network->getIpAndMask());
         }
     });
 }
开发者ID:CERTUNLP,项目名称:NgenBundle,代码行数:29,代码来源:NetworkType.php

示例4: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     /** @var \Doctrine\Orm\EntityManager $manager */
     $manager = $options['manager'];
     $query = $manager->createQuery('SELECT c FROM AppBundle:Category c ORDER BY c.name');
     $query->setHint(\Doctrine\ORM\Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
     $query->setHint(\Gedmo\Translatable\TranslatableListener::HINT_TRANSLATABLE_LOCALE, $options['locale']);
     $categories = [];
     $musicCategories = [];
     foreach ($query->getResult() as $category) {
         if (get_class($category) == 'AppBundle\\Entity\\GeneralCategory') {
             $categories[] = $category;
         } elseif (get_class($category) == 'AppBundle\\Entity\\MusicCategory') {
             $musicCategories[] = $category;
         }
     }
     $user = $builder->getData();
     $builder->add('firstName', 'text', ['label' => 'user.form.first_name'])->add('lastName', 'text', ['label' => 'user.form.last_name'])->add('wantToLearn', 'boolean_choice', ['expanded' => true, 'label' => 'user.form.want_to_learn', 'choices' => ['user.form.want_to_learn.choice.learn' => '1', 'user.form.want_to_learn.choice.teach' => '0'], 'choices_as_values' => true, 'data' => !$user->hasRole('ROLE_COMPLETE_USER') ? null : $user->getWantToLearn()])->add('categories', 'entity', ['class' => 'AppBundle:GeneralCategory', 'multiple' => true, 'expanded' => true, 'choice_list' => new ArrayChoiceList($categories), 'property' => 'name', 'label' => 'user.form.categories'])->add('musicCategories', 'entity', ['class' => 'AppBundle:MusicCategory', 'multiple' => true, 'expanded' => true, 'choice_list' => new ArrayChoiceList($musicCategories), 'property' => 'name'])->add('age', 'choice', ['label' => 'user.form.age', 'empty_data' => null, 'required' => false, 'choices' => array_combine(range(18, 100), range(18, 100))])->add('gender', 'choice', ['expanded' => true, 'label' => 'user.form.gender', 'choices' => ['M' => 'user.form.gender.m', 'F' => 'user.form.gender.f', 'X' => 'user.form.gender.x']])->add('about', 'textarea', ['label' => 'user.form.about'])->add('from', 'choice', ['label' => 'user.form.from', 'choices' => Countries::getList(), 'empty_data' => null, 'empty_value' => ''])->add('hasChildren', 'choice', ['expanded' => true, 'label' => 'user.form.has_children', 'choices' => [true => 'yes', false => 'no'], 'choice_value' => function ($currentChoiceKey) {
         return $currentChoiceKey ? 'true' : 'false';
     }])->add('profilePicture', 'hidden')->add('musicFriend', 'boolean_choice', ['expanded' => true, 'label' => 'user.form.fikatype', 'choices' => ['user.form.fikatype.fikafriend' => '0', 'user.form.fikatype.musicfriend' => '1'], 'choices_as_values' => true, 'data' => !$user->hasRole('ROLE_COMPLETE_USER') ? null : $user->isMusicFriend()])->add('municipality', 'entity', ['class' => 'AppBundle:Municipality', 'property' => 'name', 'empty_data' => null, 'required' => false, 'label' => 'user.form.municipality']);
     $user = $builder->getData();
     if (!$user->hasRole('ROLE_COMPLETE_USER')) {
         $builder->add('city', 'entity', ['label' => 'user.form.city', 'class' => 'AppBundle:City', 'query_builder' => function (EntityRepository $er) {
             return $er->createQueryBuilder('c')->orderBy('c.name', 'ASC');
         }, 'property' => 'name', 'mapped' => false, 'empty_value' => '']);
     }
 }
开发者ID:Sup3rgnu,项目名称:Kompisbyran,代码行数:27,代码来源:UserType.php

示例5: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $isExisting = $builder->getData() && $builder->getData()->getId();
     $builder->add('namePrefix', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.name_prefix.label'])->add('firstName', 'text', ['label' => 'orocrm.magento.customer.first_name.label'])->add('middleName', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.middle_name.label'])->add('lastName', 'text', ['label' => 'orocrm.magento.customer.last_name.label'])->add('nameSuffix', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.name_suffix.label'])->add('gender', 'oro_gender', ['required' => false, 'label' => 'orocrm.magento.customer.gender.label'])->add('birthday', 'oro_date', ['required' => false, 'label' => 'orocrm.magento.customer.birthday.label'])->add('email', 'email', ['label' => 'orocrm.magento.customer.email.label'])->add('vat', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.vat.label'])->add('dataChannel', 'orocrm_magento_customer_channel_select', ['label' => 'orocrm.magento.customer.data_channel.label', 'entities' => [$this->customerClassName], 'required' => true, 'disabled' => $isExisting])->add('store', 'orocrm_magento_store_select', ['label' => 'orocrm.magento.customer.store.label', 'channel_field' => 'dataChannel', 'required' => true, 'disabled' => $isExisting])->add('group', 'orocrm_magento_customer_group_select', ['label' => 'orocrm.magento.customer.group.label', 'channel_field' => 'dataChannel', 'required' => true])->add('addresses', 'oro_address_collection', ['label' => 'orocrm.magento.customer.addresses.label', 'type' => 'orocrm_magento_customer_addresses', 'required' => true, 'options' => ['data_class' => $this->customerAddressClassName]])->add('contact', 'orocrm_contact_select', ['label' => 'orocrm.magento.customer.contact.label'])->add('account', 'orocrm_account_select', ['label' => 'orocrm.magento.customer.account.label']);
     if ($this->isPasswordSetAllowed($builder->getData())) {
         $builder->add('generatedPassword', 'text', ['label' => 'orocrm.magento.customer.password.label', 'tooltip' => 'orocrm.magento.customer.password.tooltip', 'required' => false, 'constraints' => [new Length(['min' => 6])]]);
     }
     $builder->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) {
         /** @var Customer $entity */
         $entity = $event->getData();
         $dataChannel = $entity->getDataChannel();
         if ($dataChannel) {
             $entity->setChannel($dataChannel->getDataSource());
         }
         $store = $entity->getStore();
         if ($store) {
             $entity->setWebsite($store->getWebsite());
         }
         if (!$entity->getAddresses()->isEmpty()) {
             /** @var Address $address */
             foreach ($entity->getAddresses() as $address) {
                 if (!$address->getChannel()) {
                     $address->setChannel($entity->getChannel());
                 }
             }
         }
     });
 }
开发者ID:rodolfobandeira,项目名称:crm,代码行数:31,代码来源:CustomerType.php

示例6: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $id_category = null;
     if ($builder->getData()->getCategory() instanceof Category) {
         $id_category = $builder->getData()->getCategory()->getId();
     }
     if (isset($_POST['piapp_gedmobundle_contenttype']['category'])) {
         $id_category = $_POST['piapp_gedmobundle_contenttype']['category'];
     }
     $builder->add('enabled', 'checkbox', array('data' => true, 'label' => 'pi.form.label.field.enabled', "label_attr" => array("class" => "content_collection")))->add('category', 'entity', array('class' => 'PiAppGedmoBundle:Category', 'query_builder' => function (EntityRepository $er) use($id_category) {
         $translatableListener = $this->_container->get('gedmo.listener.translatable');
         $translatableListener->setTranslationFallback(true);
         return $er->createQueryBuilder('k')->select('k')->where('k.type = :type')->andWhere("k.id IN (:id)")->orderBy('k.name', 'ASC')->setParameter('id', $id_category)->setParameter('type', 3);
     }, 'empty_value' => 'pi.form.label.select.choose.category', 'label' => "pi.form.label.field.category", 'multiple' => false, 'required' => false, "attr" => array("class" => "pi_simpleselect ajaxselect", "data-url" => $this->_container->get('sfynx.tool.route.factory')->getRoute("admin_gedmo_category_selectentity_ajax", array('type' => 3)), "data-selectid" => $id_category, "data-max" => 50), 'widget_suffix' => '<a class="button-ui-mediatheque button-ui-dialog"
                                 title="Ajouter une catégorie"
                                 data-title="Catégorie"
                                 data-href="' . $this->_container->get('sfynx.tool.route.factory')->getRoute("admin_gedmo_category_new", array("NoLayout" => "false", 'type' => 3)) . '"
                                 data-selectid="#piapp_gedmobundle_categorytype_id"
                                 data-selecttitle="#piapp_gedmobundle_categorytype_name"
                                 data-insertid="#piapp_gedmobundle_contenttype_category"
                                 data-inserttype="multiselect"
                                 ></a>'))->add('descriptif', 'text', array('label' => 'pi.form.label.field.description', "label_attr" => array("class" => "content_collection")))->add('pageurl', 'entity', array('class' => 'SfynxCmfBundle:Page', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageHtml();
     }, 'property' => 'route_name', 'empty_value' => 'pi.form.label.select.choose.option', 'multiple' => false, 'required' => false, "label" => "pi.form.label.field.url", "attr" => array("class" => "pi_simpleselect"), "label_attr" => array("class" => "content_collection")))->add('url', 'text', array('required' => false, "label" => "pi.form.label.field.or", "label_attr" => array("class" => "content_collection")))->add('content', 'textarea', array("attr" => array("class" => "pi_editor_simple_easy"), 'required' => false, 'label' => "pi.form.label.field.content", "label_attr" => array("class" => "content_collection")))->add('pagecssclass');
 }
开发者ID:pigroupe,项目名称:PiAppGedmoBundle,代码行数:25,代码来源:ContentType.php

示例7: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $id_media = null;
     // get the id of media
     if ($builder->getData()->getMedia() instanceof \Sfynx\MediaBundle\Entity\Mediatheque) {
         $id_media = $builder->getData()->getMedia()->getId();
     }
     if (isset($_POST['piapp_gedmobundle_organigramtype']['media'])) {
         $id_media = $_POST['piapp_gedmobundle_organigramtype']['media'];
     }
     $choiceList = $this->_em->getRepository("PiAppGedmoBundle:Organigram")->getArrayAllByField('category');
     if (!isset($choiceList) || !count($choiceList)) {
         $choiceList = array();
     }
     $builder->add('enabled', 'checkbox', array('data' => true))->add('page', 'entity', array('class' => 'SfynxCmfBundle:Page', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageHtml();
     }, 'property' => 'route_name', 'empty_value' => 'pi.form.label.select.choose.option', "label" => "pi.form.label.field.url", 'multiple' => false, 'required' => false, "attr" => array("class" => "pi_simpleselect")))->add('category', 'choice', array('choices' => $choiceList, 'multiple' => false, 'required' => false, 'empty_value' => 'pi.form.label.select.choose.category', 'label' => "pi.form.label.field.category", "attr" => array("class" => "pi_simpleselect")))->add('categoryother', 'text', array("label" => "pi.form.label.field.or", 'required' => false))->add('parent', 'entity', array('class' => 'PiAppGedmoBundle:Organigram', 'query_builder' => function (EntityRepository $er) {
         $translatableListener = $this->_container->get('gedmo.listener.translatable');
         $translatableListener->setTranslationFallback(true);
         return $er->createQueryBuilder('k')->select('k')->orderBy('k.lft', 'ASC');
     }, 'empty_value' => 'pi.form.label.select.choose.option', 'multiple' => false, 'required' => false, "attr" => array("class" => "pi_simpleselect")))->add('title', 'text', array('label' => "pi.form.label.field.title"))->add('descriptif', 'textarea', array('label' => 'pi.form.label.field.description'))->add('question')->add('content', 'textarea', array('label' => "pi.form.label.field.content", "attr" => array("class" => "pi_editor_simple_easy")))->add('media', 'entity', array('class' => 'SfynxMediaBundle:Mediatheque', 'query_builder' => function (EntityRepository $er) use($id_media) {
         $translatableListener = $this->_container->get('gedmo.listener.translatable');
         $translatableListener->setTranslationFallback(true);
         return $er->createQueryBuilder('a')->select('a')->where("a.id IN (:id)")->setParameter('id', $id_media);
     }, 'empty_value' => 'pi.form.label.select.choose.media', 'label' => "Media", 'multiple' => false, 'required' => false, 'constraints' => array(), "label_attr" => array("class" => 'bg_image_collection'), "attr" => array("class" => "pi_simpleselect ajaxselect", "data-url" => $this->_container->get('sfynx.tool.route.factory')->getRoute("admin_gedmo_media_selectentity_ajax", array('type' => 'image')), "data-selectid" => $id_media, "data-max" => 50), 'widget_suffix' => '<a class="button-ui-mediatheque button-ui-dialog"
          				title="Ajouter une image à la médiatheque"
          				data-title="Mediatheque"
          				data-href="' . $this->_container->get('sfynx.tool.route.factory')->getRoute("admin_gedmo_media_new", array("NoLayout" => "false", "category" => '', 'status' => 'image')) . '"
          				data-selectid="#sfynx_mediabundle_mediatype_id"
          				data-selecttitle="#sfynx_mediabundle_mediatype_title"
          				data-insertid="#piapp_gedmobundle_blocktype_media"
          				data-inserttype="multiselect"
          				></a>'));
 }
开发者ID:pigroupe,项目名称:PiAppGedmoBundle,代码行数:34,代码来源:OrganigramType.php

示例8: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('type', ChoiceType::class, ['label' => 'Type', 'attr' => ['class' => 'form-control'], 'choices' => array_flip(Comment::types)])->add('content', TextareaType::class, ['label' => 'Content', 'attr' => ['class' => 'form-control', 'maxlength' => 200]]);
     if ($builder->getData()) {
         $exist = $builder->getData()->getId();
         $builder->add('secret', SpamType::class)->add('save', SubmitType::class, ['label' => $exist ? 'Update' : 'Add', 'attr' => ['class' => 'btn btn-' . ($exist ? 'warning' : 'success') . ' pull-right', 'icon' => 'fa fa-' . ($exist ? 'check' : 'comment')]]);
     }
 }
开发者ID:pixocode,项目名称:cidbox,代码行数:12,代码来源:CommentType.php

示例9: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $id = $builder->getData()->getBranch()->getMeta()->getId();
     $exclude = $builder->getData()->getBranch()->getId();
     $builder->remove('folder')->remove('packages')->remove('actions')->add('branch', 'entity', array('class' => 'HLPNebulaBundle:Branch', 'expanded' => false, 'multiple' => false, 'query_builder' => function (\HLP\NebulaBundle\Entity\BranchRepository $repo) use($id, $exclude) {
         return $repo->getBranchQueryBuilder($id, $exclude);
     }));
 }
开发者ID:ngld,项目名称:hlp-nebula,代码行数:12,代码来源:BuildTransferType.php

示例10: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $content = '';
     if ($builder->getData() instanceof Content) {
         $content = $builder->getData()->getContent();
     }
     $builder->add('scroll', 'scroll', array('label' => 'term_of_service', 'data' => $content))->add('terms_of_service', 'checkbox', array('mapped' => false, 'label' => 'terms_of_service_acceptance'));
 }
开发者ID:claroline,项目名称:distribution,代码行数:8,代码来源:TermsOfServiceType.php

示例11: buildForm

 /**
  * Build form
  *
  * @param \Symfony\Component\Form\FormBuilderInterface $builder
  * @param array                                        $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     /** @var $domain \Jeboehm\Lampcp\CoreBundle\Entity\Domain */
     $domain = $builder->getData()->getDomain();
     $zoneCollectionTransformer = new ZoneCollectionTransformer($builder->getData()->getZoneCollection());
     $dnsResourceRecordType = new DnsResourceRecordType();
     $builder->add('subdomain', null, array('required' => false, 'attr' => array('append_input' => '.' . $domain->getDomain())))->add($builder->create('zone_collection', 'collection', array('type' => $dnsResourceRecordType, 'allow_add' => true, 'allow_delete' => true, 'options' => array('required' => false)))->addModelTransformer($zoneCollectionTransformer));
 }
开发者ID:jeboehm,项目名称:lampcp,代码行数:14,代码来源:DnsType.php

示例12: getAvailableRoles

 private function getAvailableRoles(FormBuilderInterface $builder)
 {
     $roles = ['ROLE_ADMIN' => 'Admin', 'ROLE_USER' => 'User'];
     if ($builder->getData() && $builder->getData()->getId() === 1) {
         $roles['ROLE_SUPER_ADMIN'] = sprintf('%s (super)', $roles['ROLE_ADMIN']);
         unset($roles['ROLE_ADMIN']);
     }
     return $roles;
 }
开发者ID:clastic,项目名称:clastic,代码行数:9,代码来源:UserFormType.php

示例13: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $choices = [];
     foreach ($builder->getData()->getChoices() as $choice) {
         $choices[$choice->getId()] = $choice->getAnswer();
     }
     $supportsMultiple = $builder->getData()->getMaxNumberOfAnswers() === 1 ? false : true;
     $builder->add('poll', ChoiceType::class, ['choices' => $choices, 'mapped' => false, 'multiple' => $supportsMultiple, 'expanded' => true]);
 }
开发者ID:madrakio,项目名称:streamperk-poll-bundle,代码行数:13,代码来源:PollVoteType.php

示例14: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $isExisting = $builder->getData() && $builder->getData()->getId();
     $builder->add('namePrefix', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.name_prefix.label'])->add('firstName', 'text', ['label' => 'orocrm.magento.customer.first_name.label'])->add('middleName', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.middle_name.label'])->add('lastName', 'text', ['label' => 'orocrm.magento.customer.last_name.label'])->add('nameSuffix', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.name_suffix.label'])->add('gender', 'oro_gender', ['required' => false, 'label' => 'orocrm.magento.customer.gender.label'])->add('birthday', 'oro_date', ['required' => false, 'label' => 'orocrm.magento.customer.birthday.label'])->add('email', 'email', ['label' => 'orocrm.magento.customer.email.label'])->add('vat', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.vat.label'])->add('dataChannel', 'orocrm_magento_customer_channel_select', ['label' => 'orocrm.magento.customer.data_channel.label', 'entities' => [$this->customerClassName], 'required' => true, 'disabled' => $isExisting])->add('store', 'orocrm_magento_store_select', ['label' => 'orocrm.magento.customer.store.label', 'channel_field' => 'dataChannel', 'required' => true, 'disabled' => $isExisting])->add('group', 'orocrm_magento_customer_group_select', ['label' => 'orocrm.magento.customer.group.label', 'channel_field' => 'dataChannel', 'required' => true])->add('addresses', 'oro_address_collection', ['label' => 'orocrm.magento.customer.addresses.label', 'type' => 'orocrm_magento_customer_addresses', 'required' => true, 'options' => ['data_class' => $this->customerAddressClassName]])->add('contact', 'orocrm_contact_select', ['label' => 'orocrm.magento.customer.contact.label'])->add('account', 'orocrm_account_select', ['label' => 'orocrm.magento.customer.account.label']);
     if ($this->isPasswordSetAllowed($builder->getData())) {
         $builder->add('generatedPassword', 'text', ['label' => 'orocrm.magento.customer.password.label', 'tooltip' => 'orocrm.magento.customer.password.tooltip', 'required' => false, 'constraints' => [new Length(['min' => 6])]]);
     }
     $this->initFormEvents($builder);
 }
开发者ID:antrampa,项目名称:crm,代码行数:12,代码来源:CustomerType.php

示例15: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('country', 'entity', array('class' => 'SiploMediaBundle:Country', 'placeholder' => '', 'read_only' => 'true,'));
     $builder->add('title');
     $builder->add('photo', 'vich_file');
     $builder->add('category', 'entity', array('class' => 'SiploMediaBundle:Category', 'choices' => $builder->getData()->getCountry()->getCategories(), 'required' => 'true'));
     $builder->add('subCategory', 'entity', array('class' => 'SiploMediaBundle:SubCategory', 'choices' => $builder->getData()->getCountry()->getSubCategories(), 'required' => 'true'));
     $builder->add('upload', 'submit');
 }
开发者ID:buddhikajay,项目名称:TubeSite,代码行数:13,代码来源:PhotoType.php


注:本文中的Symfony\Component\Form\FormBuilderInterface::getData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。