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


PHP Form\FormView类代码示例

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


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

示例1: buildView

 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     foreach ($options as $key => $value) {
         $view->set($key, $value);
     }
     $view->set('countries', $this->_getCountryList());
 }
开发者ID:TMBaay,项目名称:MEDTrip---Healthcareabroad,代码行数:7,代码来源:FancyCountryFieldType.php

示例2: buildViewBottomUp

 public function buildViewBottomUp(FormView $view, FormInterface $form)
 {
     foreach ($view->getChildren() as $child) {
         /* @var \Symfony\Component\Form\FormView $child */
         $child->set('full_name', $child->get('name'));
     }
 }
开发者ID:hatimeria,项目名称:HatimeriaDotpayBundle,代码行数:7,代码来源:RequestFormType.php

示例3: buildView

 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form)
 {
     $view->set('value', $form->getAttribute('value'))->set('checked', (bool) $form->getClientData());
     if ($view->hasParent()) {
         $view->set('full_name', $view->getParent()->get('full_name'));
     }
 }
开发者ID:artz20,项目名称:Tv-shows-zone,代码行数:10,代码来源:RadioType.php

示例4: buildView

 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form)
 {
     $configs = $form->getAttribute('configs');
     $datas = $form->getClientData();
     if (!empty($datas)) {
         if ($form->getAttribute('multiple')) {
             $datas = is_scalar($datas) ? explode(',', $datas) : $datas;
             $value = array();
             foreach ($datas as $data) {
                 if (!$data instanceof File) {
                     $data = new File($form->getAttribute('rootDir') . '/' . $data);
                 }
                 $value[] = $configs['folder'] . '/' . $data->getFilename();
             }
             $value = implode(',', $value);
         } else {
             if (!$datas instanceof File) {
                 $datas = new File($form->getAttribute('rootDir') . '/' . $datas);
             }
             $value = $configs['folder'] . '/' . $datas->getFilename();
         }
         $view->set('value', $value);
     }
     $view->set('type', 'hidden')->set('configs', $form->getAttribute('configs'));
 }
开发者ID:raziel057,项目名称:GenemuFormBundle,代码行数:28,代码来源:FileType.php

示例5: finishView

 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     $view->setAttribute('data-date', Util::ICUTojQueryDate($form->getAttribute('date_pattern')));
     $timePattern = $form->getAttribute('time_pattern');
     $view->setAttribute('data-time', Util::ICUTojQueryDate($timePattern));
     $view->setAttribute('data-ampm', false !== strpos($timePattern, 'h') ? '1' : '0');
 }
开发者ID:senthilkumar3282,项目名称:LyraAdminBundle,代码行数:7,代码来源:DateTimePickerType.php

示例6: getRoot

 private function getRoot(FormView $form)
 {
     while ($form->getParent() != null) {
         $form = $form->getParent();
     }
     return $form;
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:7,代码来源:FieldErrors.php

示例7: buildView

 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form)
 {
     $view->set('widget', $form->getAttribute('widget'));
     if ('single_text' === $form->getAttribute('widget')) {
         $view->set('type', 'datetime');
     }
 }
开发者ID:nashadalam,项目名称:symfony,代码行数:10,代码来源:DateTimeType.php

示例8: buildView

 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $view->set('parent_field', $form->getAttribute('parent_field'));
     $view->set('entity_alias', $form->getAttribute('entity_alias'));
     $view->set('no_result_msg', $form->getAttribute('no_result_msg'));
     $view->set('empty_value', $form->getAttribute('empty_value'));
 }
开发者ID:nucleartux,项目名称:ShtumiUsefulBundle1,代码行数:7,代码来源:DependentFilteredEntityType.php

示例9: zform

 public function zform(\Symfony\Component\Form\FormView $field)
 {
     $attr = $field->get('attr', array());
     $attr['class'] = 'zTextForm';
     $field->set('attr', $attr);
     return $this->helper->render(array('field' => $field, 'id' => 1));
 }
开发者ID:Nek-,项目名称:ZCodeBundle,代码行数:7,代码来源:ZCodeExtension.php

示例10: buildView

 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form)
 {
     $value = $form->getClientData();
     // set string representation
     if (true === $value) {
         $value = 'true';
     } else {
         if (false === $value) {
             $value = 'false';
         } else {
             if (null === $value) {
                 $value = 'null';
             } else {
                 if (is_array($value)) {
                     $value = implode(', ', $value);
                 } else {
                     if ($value instanceof \DateTime) {
                         $value = $value->format('Y-m-d H:i:s');
                     } else {
                         if (is_object($value)) {
                             if (method_exists($value, '__toString')) {
                                 $value = $value->__toString();
                             } else {
                                 $value = get_class($value);
                             }
                         }
                     }
                 }
             }
         }
     }
     $view->set('value', (string) $value);
 }
开发者ID:raziel057,项目名称:GenemuFormBundle,代码行数:36,代码来源:PlainType.php

示例11: buildView

 /**
  * @param \Symfony\Component\Form\FormView      $view
  * @param \Symfony\Component\Form\FormInterface $form
  */
 public function buildView(FormView $view, FormInterface $form)
 {
     $format = $form->getAttribute('format');
     $imageSrc = $view->get('image_src');
     if ($imageSrc !== null && $format !== null) {
         $view->set('image_src', $this->imManager->getUrl($format, $imageSrc));
     }
 }
开发者ID:nacmartin,项目名称:SnowcapImBundle,代码行数:12,代码来源:ImageTypeExtension.php

示例12: array

 function it_changes_label_attribute_for(FormInterface $form, FormView $view, FormView $fileView)
 {
     $form->getName()->willReturn('file');
     $view->offsetGet('file')->willReturn($fileView);
     $view->vars = array('label_attr' => array());
     $fileView->vars = array('id' => 'form_file_file');
     $this->finishView($view, $form, array());
     expect($view->vars['label_attr']['for'])->toBe('form_file_file');
 }
开发者ID:norzechowicz,项目名称:doctrine-extensions-bundle,代码行数:9,代码来源:RemovableFileTypeSpec.php

示例13: buildViewBottomUp

 /**
  * Removes CSRF fields from all the form views except the root one.
  *
  * @param FormView      $view The form view
  * @param FormInterface $form The form
  */
 public function buildViewBottomUp(FormView $view, FormInterface $form)
 {
     if ($view->hasParent() && $form->hasAttribute('csrf_field_name')) {
         $name = $form->getAttribute('csrf_field_name');
         if (isset($view[$name])) {
             unset($view[$name]);
         }
     }
 }
开发者ID:artz20,项目名称:Tv-shows-zone,代码行数:15,代码来源:FormTypeCsrfExtension.php

示例14: finishView

 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     /** @var FormView[] $fields */
     if ($view->offsetExists('submit_group')) {
         $fields = array($view->offsetGet('submit_group'));
         $view->offsetUnset('submit_group');
         $view->children = $view->children + $fields;
     }
     parent::finishView($view, $form, $options);
 }
开发者ID:xavier-dubreuil,项目名称:LightCMS,代码行数:10,代码来源:NodeType.php

示例15: finishView

 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     $configs = array_merge($options['configs'], array('id' => $view->vars['id'], 'name_id' => $view->getChild('name')->vars['id'], 'original_name_id' => $view->getChild('originalName')->vars['id'], 'size_id' => $view->getChild('size')->vars['id'], 'title_id' => $view->getChild('title')->vars['id'], 'caption_id' => $view->getChild('caption')->vars['id'], 'description_id' => $view->getChild('description')->vars['id'], 'hash_id' => $view->getChild('hash')->vars['id'], 'enabled_id' => $view->getChild('enabled')->vars['id'], 'scheduled_for_deletion_id' => $view->getChild('scheduledForDeletion')->vars['id'], 'enabled_value' => false));
     $file = $form->getData();
     if ($file instanceof FileInterface && null !== $file->getId()) {
         $configs['enabled_value'] = $file->isEnabled();
     }
     $this->session->set($view->vars['id'], $configs);
     $view->vars['configs'] = $configs;
 }
开发者ID:firano,项目名称:form-bundle,代码行数:10,代码来源:FileUploadType.php


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