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


PHP Form\AbstractType类代码示例

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


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

示例1: formEncode

 public function formEncode($entity, Form $form, AbstractType $formType)
 {
     $baseName = $formType->getName();
     $payload = array();
     foreach ($form->getIterator() as $el) {
         if (is_array($entity)) {
             $payload[$baseName . '[' . $el->getName() . ']'] = $entity[$el->getName()];
         }
     }
     return $payload;
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:11,代码来源:ApiManager.php

示例2: doTestSetDefaultOptions

 /**
  * @param AbstractType      $type
  * @param ConfigIdInterface $configId
  * @param bool              $immutable
  * @param array             $options
  * @param array             $expectedOptions
  *
  * @return array
  */
 protected function doTestSetDefaultOptions(AbstractType $type, ConfigIdInterface $configId, $immutable, array $options = [], array $expectedOptions = [])
 {
     $this->setIsReadOnlyExpectations($configId, $immutable);
     $resolver = $this->getOptionsResolver();
     $type->setDefaultOptions($resolver);
     $options['config_id'] = $configId;
     $resolvedOptions = $resolver->resolve($options);
     foreach ($expectedOptions as $name => $val) {
         $this->assertEquals($val, $resolvedOptions[$name], $name);
         unset($resolvedOptions[$name]);
     }
     return $resolvedOptions;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:22,代码来源:AbstractConfigTypeTestCase.php

示例3: getEntityErrorMap

 protected function getEntityErrorMap($entity, AbstractType $formType = null)
 {
     /** @var ConstraintViolation[] $errors */
     $errors = $this->get('validator')->validate($entity);
     $mapping = [];
     foreach ($errors as $err) {
         if ($formType === null) {
             $mapping[$err->getPropertyPath()] = $err->getMessage();
         } else {
             $mapping[$formType->getName() . '_' . $err->getPropertyPath()] = $err->getMessage();
         }
     }
     return $mapping;
 }
开发者ID:scottstuff,项目名称:GCProtractorJS,代码行数:14,代码来源:BaseController.php

示例4: buildForm

 /**
  * (non-PHPdoc)
  * @see \Symfony\Component\Form\AbstractType::buildForm()
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->add('title', 'text');
     //$builder->add('category');
     $builder->add('post', $options['post_form'], array('data_class' => $options['post_class'], 'label' => false, 'mapped' => false));
 }
开发者ID:rhapsody-project,项目名称:social-bundle,代码行数:11,代码来源:TopicType.php

示例5: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     if ($this->formType) {
         $this->formType->configureOptions($resolver);
     }
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:10,代码来源:EntitySelectTypeStub.php

示例6: setDefaultOptions

 /**
  * @param \Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver
  *
  * @return void
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     parent::setDefaultOptions($resolver);
     $resolver->setRequired(self::OPTION_SALUTATION_CHOICES);
     $resolver->setRequired(self::OPTION_COUNTRY_CHOICES);
     $resolver->setRequired(self::OPTION_PREFERRED_COUNTRY_CHOICES);
 }
开发者ID:spryker,项目名称:Customer,代码行数:12,代码来源:AddressForm.php

示例7: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     if (true === $options['multiple']) {
         $builder->addViewTransformer(new CollectionToArrayTransformer(), true);
     }
 }
开发者ID:webburza,项目名称:sylius-article-bundle,代码行数:10,代码来源:ProductChoiceType.php

示例8: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->add('Notas', null, array('label' => 'Asunto', 'attr' => array('placeholder' => ''), 'required' => true))->add('Categoria', 'Symfony\\Bridge\\Doctrine\\Form\\Type\\EntityType', array('label' => 'Categoría', 'attr' => array('help' => 'Si no sabe cual seleccionar, puede dejarla en blanco para que el administrador asigne una.'), 'class' => 'Yacare\\RequerimientosBundle\\Entity\\Categoria', 'query_builder' => function (\Yacare\RequerimientosBundle\Entity\CategoriaRepository $er) {
         return $er->ObtenerQueryBuilderPublicas();
     }, 'required' => false))->add('UsuarioNombre', null, array('label' => 'Nombre', 'attr' => array('placeholder' => 'Su nombre'), 'required' => false))->add('UsuarioEmail', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\EmailType', array('label' => 'E-mail', 'attr' => array('placeholder' => 'Su dirección de correo electrónico'), 'required' => false))->add('UsuarioDireccion', null, array('label' => 'Dirección', 'attr' => array('placeholder' => 'Su domicilio'), 'required' => false))->add('UsuarioTelefono', null, array('label' => 'Teléfono', 'attr' => array('placeholder' => 'Su número de teléfono'), 'required' => false));
 }
开发者ID:Rezequiel,项目名称:yacare,代码行数:7,代码来源:RequerimientoAnonimoType.php

示例9: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->add('Notas', null, array('label' => 'Notas', 'required' => false))->add('Usuario', 'Symfony\\Bridge\\Doctrine\\Form\\Type\\EntityType', array('label' => 'Encargado', 'choice_label' => 'NombreVisible', 'attr' => array('class' => 'tapir-input-320'), 'class' => 'Yacare\\BaseBundle\\Entity\\Persona', 'query_builder' => function (\Yacare\BaseBundle\Entity\PersonaRepository $er) {
         return $er->ObtenerQueryBuilderPorRol('ROLE_REQUERIMIENTOS_ENCARGADO');
     }))->add('Requerimiento', 'Tapir\\FormBundle\\Form\\Type\\EntityHiddenType', array('class' => 'Yacare\\RequerimientosBundle\\Entity\\Requerimiento'));
 }
开发者ID:Drake86cnf,项目名称:yacare,代码行数:7,代码来源:AsignarType.php

示例10: finishView

 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     // convert the route into an URL
     $view->vars['limit'] = $options['limit'];
     $view->vars['url'] = $options['url'];
 }
开发者ID:mapado,项目名称:typeaheadjs-bundle,代码行数:10,代码来源:TypeaheadType.php

示例11: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->add('Notas', null, array('label' => 'Notas', 'required' => false))->add('Usuario', 'entity', array('label' => 'Encargado', 'property' => 'NombreVisible', 'class' => 'Yacare\\BaseBundle\\Entity\\Persona', 'query_builder' => function (\Yacare\BaseBundle\Entity\PersonaRepository $er) {
         return $er->ObtenerQueryBuilderPorRol('ROLE_REQUERIMIENTOS_ENCARGADO');
     }))->add('Requerimiento', 'entity_hidden', array('class' => 'Yacare\\RequerimientosBundle\\Entity\\Requerimiento'));
 }
开发者ID:alediazrc,项目名称:yacare,代码行数:7,代码来源:AsignarType.php

示例12: buildView

 /**
  * @param FormView      $view
  * @param FormInterface $form
  * @param array         $options
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     if (isset($view->vars['name']) && '' !== $view->vars['name'] && null !== $view->vars['name']) {
         $view->vars['label'] = 'open_orchestra_backoffice.form.content_type.default_listable_label.' . $view->vars['name'];
     }
 }
开发者ID:open-orchestra,项目名称:open-orchestra-cms-bundle,代码行数:12,代码来源:DefaultListableCheckboxType.php

示例13: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     // On fait appel à la méthode buildForm du parent, qui va ajouter tous les champs à $builder
     parent::buildForm($builder, $options);
     // On supprime celui qu'on ne veut pas dans le formulaire de modification
     $builder->remove('name');
 }
开发者ID:HeliosDX,项目名称:BlogWim1,代码行数:7,代码来源:BlogEditType.php

示例14: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('nameable' => false, 'deleteable' => false, 'downloadable' => true, 'maxWidth' => 320, 'maxHeight' => 180, 'minWidth' => 16, 'minHeight' => 16, 'previewImages' => true, 'previewAsCanvas' => true, 'previewFilter' => null, 'multipart' => true, 'novalidate' => true, 'required' => false));
     $resolver->setAllowedValues('multipart', array(true))->setAllowedValues('novalidate', array(true))->setAllowedValues('required', array(false));
     $resolver->setAllowedTypes('nameable', array('string', 'bool'))->setAllowedTypes('deleteable', array('string', 'bool'))->setAllowedTypes('downloadable', array('bool'))->setAllowedTypes('maxWidth', array('integer'))->setAllowedTypes('maxHeight', array('integer'))->setAllowedTypes('minWidth', array('integer'))->setAllowedTypes('minHeight', array('integer'))->setAllowedTypes('previewImages', array('bool'))->setAllowedTypes('previewAsCanvas', array('bool'))->setAllowedTypes('previewFilter', array('string', 'null'));
 }
开发者ID:Lionel09,项目名称:FormExtensionsBundle,代码行数:10,代码来源:SingleUploadType.php

示例15: buildView

 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $view->vars['labelAdd'] = $options['labelAdd'];
     $view->vars['labelDelete'] = $options['labelDelete'];
     $view->vars['prototype_name'] = $options['prototype_name'];
 }
开发者ID:hunter686,项目名称:hitechonline,代码行数:7,代码来源:OrderProductCollectionType.php


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