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


PHP FormInterface::remove方法代码示例

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


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

示例1: manageLinkTypeRelatedFields

 /**
  * Add the types related to the LinkType value.
  *
  * @param                                    $linkType
  * @param                                    $locale
  * @param FormBuilderInterface|FormInterface $form
  * @param FormBuilderInterface               $builder
  */
 protected function manageLinkTypeRelatedFields($linkType, $locale, $form, FormBuilderInterface $builder)
 {
     $form->remove('route');
     $form->remove('url');
     $form->remove('attachedWidget');
     $form->remove('viewReference');
     $form->remove('locale');
     switch ($linkType) {
         case Link::TYPE_VIEW_REFERENCE:
             $locale = $locale ?: $this->requestStack->getCurrentRequest()->getLocale();
             $form->add('viewReference', ChoiceType::class, ['label' => 'form.link_type.view_reference.label', 'required' => true, 'attr' => ['novalidate' => 'novalidate'], 'placeholder' => 'form.link_type.view_reference.blank', 'choices' => $this->viewReferenceRepository->getChoices($locale), 'choices_as_values' => true, 'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group']])->add('locale', ChoiceType::class, ['label' => 'form.link_type.locale.label', 'choices' => array_combine($this->availableLocales, $this->availableLocales), 'attr' => ['data-refreshOnChange' => 'true']]);
             break;
         case Link::TYPE_ROUTE:
             $form->add('route', null, ['label' => 'form.link_type.route.label', 'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'], 'required' => true, 'attr' => ['novalidate' => 'novalidate', 'placeholder' => 'form.link_type.route.placeholder']])->add('route_parameters', JsonType::class, ['label' => 'form.link_type.route_parameters.label', 'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'], 'required' => true, 'attr' => ['novalidate' => 'novalidate', 'placeholder' => 'form.link_type.route_parameters.placeholder']]);
             break;
         case Link::TYPE_URL:
             $form->add('url', null, ['label' => 'form.link_type.url.label', 'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'], 'required' => true, 'attr' => ['novalidate' => 'novalidate', 'placeholder' => 'form.link_type.url.placeholder']]);
             break;
         case Link::TYPE_WIDGET:
             $form->add('attachedWidget', EntityType::class, ['label' => 'form.link_type.attachedWidget.label', 'placeholder' => 'form.link_type.attachedWidget.blank', 'class' => 'VictoireWidgetBundle:Widget', 'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'], 'required' => true, 'attr' => ['novalidate' => 'novalidate']]);
             break;
         case Link::TYPE_NONE:
         case null:
             $form->remove('target');
             break;
     }
 }
开发者ID:victoire,项目名称:victoire,代码行数:35,代码来源:LinkType.php

示例2: updateForm

 /**
  * @param FormInterface $form
  * @param UserEmailOrigin $emailOrigin
  */
 protected function updateForm(FormInterface $form, UserEmailOrigin $emailOrigin)
 {
     if (!empty($emailOrigin->getAccessToken())) {
         $form->add('checkFolder', 'button', ['label' => $this->translator->trans('oro.email.retrieve_folders.label'), 'attr' => ['class' => 'btn btn-primary']])->add('folders', 'oro_email_email_folder_tree', ['label' => $this->translator->trans('oro.email.folders.label'), 'attr' => ['class' => 'folder-tree'], 'tooltip' => $this->translator->trans('oro.email.folders.tooltip')]);
         $form->remove('check');
     }
 }
开发者ID:ramunasd,项目名称:platform,代码行数:11,代码来源:GmailOAuthSubscriber.php

示例3: buildForm

 /**
  * @param FormInterface $form
  * @param string|null   $data
  */
 private function buildForm(FormInterface $form, $data)
 {
     $form->remove('value');
     if ($data === null || in_array($data, TextFilter::getSimpleTypes(), true)) {
         $form->add('value', TextForm::class);
     }
 }
开发者ID:php-lug,项目名称:lug,代码行数:11,代码来源:TextFilterSubscriber.php

示例4: manageAutoplaySpeed

 /**
  * @param FormInterface $form
  * @param $autoplay
  */
 private function manageAutoplaySpeed(FormInterface $form, $autoplay = false)
 {
     if ($autoplay) {
         $form->add('autoplaySpeed', null, ['label' => 'widget_slider.form.autoplaySpeed.label']);
     } else {
         $form->remove('autoplaySpeed');
     }
 }
开发者ID:LoicGoyet,项目名称:WidgetSliderBundle,代码行数:12,代码来源:WidgetSliderType.php

示例5: updateForm

 /**
  * @param FormInterface $form
  * @param UserEmailOrigin $emailOrigin
  */
 protected function updateForm(FormInterface $form, UserEmailOrigin $emailOrigin)
 {
     //for empty() function must be only variable for compatibility with PHP 5.4
     $token = $emailOrigin->getAccessToken();
     if (!empty($token)) {
         $form->add('checkFolder', 'button', ['label' => $this->translator->trans('oro.email.retrieve_folders.label'), 'attr' => ['class' => 'btn btn-primary']])->add('folders', 'oro_email_email_folder_tree', ['label' => $this->translator->trans('oro.email.folders.label'), 'attr' => ['class' => 'folder-tree'], 'tooltip' => $this->translator->trans('oro.email.folders.tooltip')]);
         $form->remove('check');
     }
 }
开发者ID:woei66,项目名称:platform,代码行数:13,代码来源:GmailOAuthSubscriber.php

示例6: buildForm

 /**
  * @param FormInterface $form
  * @param string|null   $data
  */
 private function buildForm(FormInterface $form, $data)
 {
     $form->remove('value')->remove('from')->remove('to');
     if ($data === null || in_array($data, NumberFilter::getSimpleTypes(), true)) {
         $form->add('value', NumberForm::class);
     } elseif (in_array($data, NumberFilter::getCompoundTypes())) {
         $form->add('from', NumberForm::class)->add('to', NumberForm::class);
     }
 }
开发者ID:php-lug,项目名称:lug,代码行数:13,代码来源:NumberFilterSubscriber.php

示例7: buildForm

 /**
  * @param FormInterface $form
  * @param string|null   $data
  */
 private function buildForm(FormInterface $form, $data)
 {
     $form->remove('value')->remove('from')->remove('to');
     if ($data === null || in_array($data, DateTimeFilter::getSimpleTypes(), true)) {
         $form->add('value', $this->innerType);
     } elseif (in_array($data, DateTimeFilter::getCompoundTypes())) {
         $form->add('from', $this->innerType)->add('to', $this->innerType);
     }
 }
开发者ID:php-lug,项目名称:lug,代码行数:13,代码来源:DateTimeFilterSubscriber.php

示例8: replaceOwnerField

 /**
  * @param FormInterface $form
  */
 protected function replaceOwnerField(FormInterface $form)
 {
     if ($this->isAssignGranted) {
         return;
     }
     $owner = $form->get($this->fieldName)->getData();
     $ownerData = method_exists($owner, 'getName') ? $owner->getName() : (string) $owner;
     $form->remove($this->fieldName);
     $form->add($this->fieldName, 'text', array('disabled' => true, 'data' => $ownerData ?: '', 'mapped' => false, 'required' => false, 'label' => $this->fieldLabel));
 }
开发者ID:Maksold,项目名称:platform,代码行数:13,代码来源:OwnerFormSubscriber.php

示例9: manageCoverRelativeFields

 protected function manageCoverRelativeFields(FormInterface $form, $isCover)
 {
     switch ($isCover) {
         case true:
             $form->remove('alt')->remove('title')->remove('legend')->remove('width')->add('height', null, array('label' => 'widget_image.form.minHeight.label', 'vic_help_label' => 'widget_image.form.height.help_label'))->remove('link')->remove('asynchronous')->remove('lazyLoad');
             break;
         default:
             $form->add('alt', null, array('label' => 'widget_image.form.alt.label', 'vic_help_label' => 'widget_image.form.alt.help_label'))->add('title', null, array('label' => 'widget_image.form.title.label'))->add('legend', null, array('label' => 'widget_image.form.legend.label'))->add('width', null, array('label' => 'widget_image.form.width.label', 'vic_help_label' => 'widget_image.form.width.help_label'))->add('height', null, array('label' => 'widget_image.form.height.label', 'vic_help_label' => 'widget_image.form.width.help_label'))->add('link', 'victoire_link')->add('lazyLoad', null, array('label' => 'widget_image.form.lazyLoad.label', 'vic_help_label' => 'widget_image.form.lazyLoad.help_label', 'required' => false))->add('asynchronous', null, array('label' => 'victoire.widget.type.asynchronous.label', 'required' => false));
             break;
     }
 }
开发者ID:vincent-chapron,项目名称:WidgetImageBundle,代码行数:11,代码来源:WidgetImageType.php

示例10: getCustomerFromProperSource

 /**
  * @param array $rawData
  * @param FormInterface $form
  *
  * @return CustomerInterface|null
  */
 protected function getCustomerFromProperSource(array $rawData, FormInterface $form)
 {
     if (null !== ($customer = $this->customerContext->getCustomer())) {
         $form->remove('email');
         return $customer;
     }
     if (!isset($rawData['email'])) {
         return null;
     }
     return $this->createCustomerIfNecessary($rawData['email']);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:17,代码来源:GuestCustomerFormSubscriber.php

示例11: updateAvailableUnits

 /**
  * {@inheritdoc}
  */
 protected function updateAvailableUnits(FormInterface $form)
 {
     /** @var OrderLineItem $item */
     $item = $form->getData();
     if (!$item->getProduct()) {
         return;
     }
     $form->remove('productUnit');
     $form->add('productUnit', ProductUnitSelectionType::NAME, ['label' => 'orob2b.product.productunit.entity_label', 'required' => true, 'query_builder' => function (ProductUnitRepository $er) use($item) {
         return $er->getProductUnitsQueryBuilder($item->getProduct());
     }]);
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:15,代码来源:OrderLineItemType.php

示例12: addElements_Prof_Matiere

 public function addElements_Prof_Matiere(FormInterface $form, Matiere $matiere = null)
 {
     $submit = $form->get('ajouter');
     $form->remove('ajouter');
     $form->add('matiere', EntityType::class, ['class' => 'EDTBundle:Matiere', 'choice_label' => 'nom', 'placeholder' => '-- choisir une matière --', 'multiple' => false, 'mapped' => true, 'data' => $matiere]);
     $profs = array();
     if ($matiere) {
         $repo = $this->em->getRepository('UserBundle:Professeur');
         $profs = $repo->createQueryBuilder('p')->leftJoin('p.prof_matieres', 'pm')->addSelect('pm')->leftJoin('pm.matiere', 'm')->addSelect('m')->where('m.id = :id_m')->setParameter('id_m', $matiere->getId())->getQuery()->getResult();
     }
     $form->add('professeur', EntityType::class, ['class' => 'UserBundle:Professeur', 'choice_label' => 'username', 'placeholder' => '--choisir une matière en premier --', 'choices' => $profs, 'multiple' => false]);
     $form->add($submit);
 }
开发者ID:bonna023,项目名称:agenda,代码行数:13,代码来源:EvenementType.php

示例13: buildForm

 /**
  * @param FormInterface $form
  * @param string|null   $data
  */
 private function buildForm(FormInterface $form, $data)
 {
     $form->remove('value');
     if ($data === null || in_array($data, ResourceType::getSimpleTypes(), true)) {
         $filter = $form->getConfig()->getOption('filter');
         if ($filter->hasOption('form')) {
             $resourceForm = $filter->getOption('form');
         } else {
             $resource = $filter->hasOption('resource') ? $filter->getOption('resource') : $filter->getName();
             $resourceForm = $this->resourceRegistry[$resource]->getChoiceForm();
         }
         $form->add('value', $resourceForm);
     }
 }
开发者ID:blazarecki,项目名称:lug,代码行数:18,代码来源:ResourceFilterSubscriber.php

示例14: addDefaultValueField

 /**
  * @param FieldTypeInterface        $data
  * @param string                    $type
  * @param FormInterface             $form
  */
 protected function addDefaultValueField(FieldTypeInterface $data, $type, FormInterface $form)
 {
     if ($form->has('default_value')) {
         $form->remove('default_value');
     }
     if (is_null($type) || !array_key_exists($type, $this->options)) {
         return;
     }
     if ($data->getType() !== $type) {
         $data->setDefaultValue(null);
     }
     if (isset($this->options[$type]['default_value'])) {
         $defaultValueField = $this->options[$type]['default_value'];
         $defaultOption = isset($defaultValueField['options']) ? $defaultValueField['options'] : array();
         $form->add('default_value', $defaultValueField['type'], $defaultOption);
     }
 }
开发者ID:open-orchestra,项目名称:open-orchestra-cms-bundle,代码行数:22,代码来源:FieldTypeTypeSubscriber.php

示例15: addElements

 protected function addElements(FormInterface $form, Province $province = null)
 {
     // Remove the submit button, we will place this at the end of the form later
     $submit = $form->get('save');
     $form->remove('save');
     // Add the province element
     $form->add('province', 'entity', array('data' => $province, 'empty_value' => '-- Choose --', 'class' => 'RubricaBundle:Provinceb', 'mapped' => false));
     // Cities are empty, unless we actually supplied a province
     $cities = array();
     if ($province) {
         // Fetch the cities from specified province
         $repo = $this->em->getRepository('RubricaBundle:City');
         $cities = $repo->findByProvince($province, array('name' => 'asc'));
     }
     // Add the city element
     $form->add('city', 'entity', array('empty_value' => '-- Select a province first --', 'class' => 'RubricaBundle:City', 'choices' => $cities));
     // Add submit button again, this time, it's back at the end of the form
     $form->add($submit);
 }
开发者ID:sourcevx,项目名称:Test,代码行数:19,代码来源:AccountType.php


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