當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。