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


PHP Form::remove方法代码示例

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


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

示例1:

 function it_does_not_remove_user_form_type_if_users_data_is_submitted(FormEvent $event, Form $form)
 {
     $event->getData()->willReturn(['user' => ['plainPassword' => 'test']]);
     $event->getForm()->shouldNotBeCalled();
     $form->remove('user')->shouldNotBeCalled();
     $this->preSubmit($event);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:7,代码来源:AddUserFormSubscriberSpec.php

示例2: aggregatePluralValues

 /**
  * @param array $data
  * @param Form $form
  * @return string
  */
 protected function aggregatePluralValues(&$data, $form)
 {
     $labelManager = $this->labelManager;
     $labelValue = '';
     $standardRules = array();
     $explicitRules = array();
     foreach ($data as $property => $value) {
         if (0 === strpos($property, self::PLURAL_FIELD_PREFIX)) {
             $pluralForm = substr($property, strlen(self::PLURAL_FIELD_PREFIX));
             if (is_numeric($pluralForm)) {
                 $standardRules[$pluralForm] = $value;
             } else {
                 $explicitRules[$pluralForm] = sprintf('%s %s', $labelManager->reverseTransformInterval($pluralForm), $value);
             }
             $form->remove($property);
             unset($data[$property]);
         }
     }
     if ($standardRules) {
         $labelValue = implode('|', $standardRules);
         if ($explicitRules) {
             $labelValue .= '|' . implode('|', $explicitRules);
         }
     } elseif ($explicitRules) {
         $labelValue = implode('|', $explicitRules);
     }
     return $labelValue;
 }
开发者ID:7rin0,项目名称:BigfootCoreBundle,代码行数:33,代码来源:AbstractTranslatableLabelType.php

示例3: removeDuplicateFields

 /**
  * Remove duplicate fields from the form
  *
  * @param Form  $form
  * @param array &$existingFields
  */
 protected function removeDuplicateFields(Form $form, array &$existingFields)
 {
     foreach (array_keys($form->all()) as $field) {
         if (in_array($field, $existingFields)) {
             $form->remove($field);
         } else {
             $existingFields[] = $field;
         }
     }
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:16,代码来源:RemoveDuplicateJobConfigurationSubscriber.php

示例4: removeFields

 /**
  * This function remove fields available if there are not present in the $data array
  * The data array might come from $request->request->all().
  *
  * This can be usefull if you don't want to send all fields will building an api. As missing
  * fields will be threated like null values.
  *
  * @param array $data
  * @param Form  $form
  */
 public static function removeFields(array $data, Form $form)
 {
     $diff = array_diff(array_keys($form->all()), array_keys($data));
     foreach ($diff as $key) {
         $form->remove($key);
     }
     foreach ($data as $name => $value) {
         if (!is_array($value)) {
             continue;
         }
         self::removeFields($value, $form[$name]);
     }
 }
开发者ID:nfouka,项目名称:jobbet_sf2.5,代码行数:23,代码来源:FormHelper.php

示例5: __construct

 public function __construct(Form $form, Request $request, UserManagerInterface $userManager)
 {
     // borrando campos no necesarios
     $form->remove('gender');
     $form->remove('website');
     $form->remove('biography');
     $form->remove('timezone');
     $form->remove('phone');
     $form->remove('locale');
     $form->remove('dateOfBirth');
     // cargando nuevos campos
     $form->add('username', null, array('label' => 'Name of User'));
     $form->add('email');
     $form->add('organization');
     //        $form->add('gravatar', 'file', array(
     //        'mapped' => false,
     //        'attr' => ['class' => 'filestyle','data-buttonBefore'=> 'true', 'data-buttonText' => 'Choose file' ]
     //    ));
     parent::__construct($form, $request, $userManager);
 }
开发者ID:aulasoftwarelibre,项目名称:fastconfer,代码行数:20,代码来源:ProfileFormHandler.php

示例6: testRemoveUnsetsFieldParent

 public function testRemoveUnsetsFieldParent()
 {
     $form = new Form('author');
     $field = $this->createMockField('firstName');
     $field->expects($this->exactly(2))->method('setParent');
     // PHPUnit fails to compare subsequent method calls with different arguments
     $form->add($field);
     $form->remove('firstName');
 }
开发者ID:nickaggarwal,项目名称:sample-symfony2,代码行数:9,代码来源:FormTest.php

示例7: cleanForm

 /**
  * Remove unnecessary fields from form
  *
  * @param array $requestData
  * @param Form $form
  */
 private function cleanForm($requestData, Form $form)
 {
     $allowedField = array_keys($requestData);
     /** @var FormInterface[] $formFields */
     $formFields = $form->all();
     foreach ($formFields as $formField) {
         $fieldName = $formField->getName();
         if (!in_array($fieldName, $allowedField)) {
             $form->remove($fieldName);
         }
     }
 }
开发者ID:glavweb,项目名称:GlavwebRestBundle,代码行数:18,代码来源:RestFormAction.php

示例8: filterForm

 private function filterForm(Form $form, $array_path, $level = 0)
 {
     $formChildren = $form->all();
     foreach ($formChildren as $formChild) {
         if ($formChild->getName() != $array_path[$level] && $formChild->getName() != '_token' && $formChild->getName() != 'submit') {
             $form->remove($formChild->getName());
         } else {
             if (count($array_path) > $level + 1 && $formChild->getName() != '_token' && $formChild->getName() != 'submit') {
                 $this->filterForm($formChild, $array_path, $level + 1);
             }
         }
     }
 }
开发者ID:kokmok,项目名称:SKCMS-Locale,代码行数:13,代码来源:TranslationFilesLoader.php


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