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


PHP FormBuilderInterface::has方法代码示例

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


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

示例1: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('subject', 'text', ['required' => true, 'label' => 'orocrm.call.subject.label'])->add('phoneNumber', 'orocrm_call_phone', ['required' => true, 'label' => 'orocrm.call.phone_number.label', 'suggestions' => $options['phone_suggestions']])->add('notes', 'oro_resizeable_rich_text', ['required' => false, 'label' => 'orocrm.call.notes.label'])->add('callDateTime', 'oro_datetime', ['required' => true, 'label' => 'orocrm.call.call_date_time.label'])->add('callStatus', 'entity', ['required' => true, 'label' => 'orocrm.call.call_status.label', 'class' => 'OroCRM\\Bundle\\CallBundle\\Entity\\CallStatus'])->add('duration', 'oro_time_interval', ['required' => false, 'label' => 'orocrm.call.duration.label'])->add('direction', 'translatable_entity', ['required' => true, 'label' => 'orocrm.call.direction.label', 'class' => 'OroCRM\\Bundle\\CallBundle\\Entity\\CallDirection']);
     if ($builder->has('contexts')) {
         $builder->addEventListener(FormEvents::POST_SET_DATA, [$this, 'addPhoneContextListener']);
     }
 }
开发者ID:antrampa,项目名称:crm,代码行数:10,代码来源:CallType.php

示例2: __construct

 /**
  * @param Request            $request
  * @param string             $type
  * @param array              $data
  * @param array              $options
  * @param ContainerInterface $container
  * @deprecated Thelia forms should not be instantiated directly. Please use BaseController::createForm() instead
  * @see BaseController::createForm()
  */
 public function __construct(Request $request, $type = "form", $data = array(), $options = array(), ContainerInterface $container = null)
 {
     // Generate the form name from the complete class name
     $this->formUniqueIdentifier = strtolower(str_replace('\\', '_', get_class($this)));
     $this->request = $request;
     $this->type = $type;
     if (null !== $container) {
         $this->container = $container;
         $this->dispatcher = $container->get("event_dispatcher");
         $this->initFormWithContainer($type, $data, $options);
     } else {
         $this->initFormWithRequest($type, $data, $options);
     }
     if (!isset($options["csrf_protection"]) || $options["csrf_protection"] !== false) {
         $this->formFactoryBuilder->addExtension(new CsrfExtension(new CsrfTokenManager(null, new SessionTokenStorage($this->getRequest()->getSession()))));
     }
     $this->formBuilder = $this->formFactoryBuilder->addExtension(new ValidatorExtension($this->validatorBuilder->getValidator()))->getFormFactory()->createNamedBuilder($this->getName(), $type, $data, $this->cleanOptions($options));
     /**
      * Build the form
      */
     $name = $this->getName();
     $event = null;
     $dispatchEvents = $this->hasContainer() && $name !== null && $name !== '';
     // We need to wrap the dispatch with a condition for backward compatibility
     if ($dispatchEvents) {
         $event = new TheliaFormEvent($this);
         /**
          * If the form has the container, disptach the events
          */
         $this->dispatcher->dispatch(TheliaEvents::FORM_BEFORE_BUILD . "." . $name, $event);
     }
     $this->buildForm();
     if ($dispatchEvents) {
         /**
          * If the form has the container, disptach the events
          */
         $this->dispatcher->dispatch(TheliaEvents::FORM_AFTER_BUILD . "." . $name, $event);
     }
     // If not already set, define the success_url field
     // This field is not included in the standard form hidden fields
     // This field is not included in the hidden fields generated by form_hidden_fields Smarty function
     if (!$this->formBuilder->has('success_url')) {
         $this->formBuilder->add("success_url", "hidden");
     }
     // If not already set, define the error_url field
     // This field is not included in the standard form hidden fields
     // This field is not included in the hidden fields generated by form_hidden_fields Smarty function
     if (!$this->formBuilder->has('error_url')) {
         $this->formBuilder->add("error_url", "hidden");
     }
     // The "error_message" field defines the error message displayed if
     // the form could not be validated. If it is empty, a standard error message is displayed instead.
     // This field is not included in the hidden fields generated by form_hidden_fields Smarty function
     if (!$this->formBuilder->has('error_message')) {
         $this->formBuilder->add("error_message", "hidden");
     }
     $this->form = $this->formBuilder->getForm();
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:67,代码来源:BaseForm.php

示例3: addHiddenValues

 /**
  * addHiddenValues
  * @param FormBuilderInterface $builder
  * @return FormBuilderInterface
  */
 public function addHiddenValues(FormBuilderInterface $builder)
 {
     $data = array();
     $nom = 'hiddenData';
     foreach ($this->parametres as $key => $value) {
         if (is_string($value) || is_array($value) || is_bool($value)) {
             $data[$key] = $value;
         }
     }
     if ($builder->has($nom)) {
         $builder->remove($nom);
     }
     $builder->add($nom, 'hidden', array('data' => urlencode(json_encode($data, true)), 'mapped' => false));
     return $builder;
 }
开发者ID:manu7772,项目名称:adaje_haltegarderie,代码行数:20,代码来源:fileFormatType.php

示例4: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if (!$builder->has('basic')) {
         return;
     }
     $basic = $builder->get('basic');
     /*
      * Don't require current password.
      */
     if ($basic->has('current_password')) {
         $basic->remove('current_password');
     }
     /*
      * This subscriber will require / unrequire the plainPassword field
      * depending on if it's a new user or existing.
      */
     $builder->addEventSubscriber(new UserTypeSubscriber());
 }
开发者ID:symedit,项目名称:symedit,代码行数:18,代码来源:UserType.php

示例5: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $event = new GadgetFormBuilderEvent($builder, $this->request, $this->gadget);
     $this->dispatcher->dispatch(KeosuEvents::GADGET_CONF_FORM_BUILD . $this->gadget->getName(), $event);
     if (!$event->isOverrideForm()) {
         $config = $this->packageManager->getConfigPackage($this->gadget->getName());
         if (isset($config['param'])) {
             $params = $config['param'];
             foreach ($params as $p) {
                 if ($builder->has($p['name'])) {
                     throw new \LogicException('The property ' . $p['name'] . ' already exists, maybe you forgot to enable overrideForm ?');
                 }
                 if (isset($p['options'])) {
                     $builder->add($p['name'], $p['type'], $p['options']);
                 } else {
                     $builder->add($p['name'], $p['type']);
                 }
             }
         }
     }
 }
开发者ID:predever,项目名称:keosu,代码行数:21,代码来源:ConfigGadgetType.php

示例6: has

 /**
  * {@inheritdoc}
  */
 public function has($key)
 {
     return $this->formBuilder->has($key);
 }
开发者ID:nagyistoce,项目名称:SonataAdminBundle,代码行数:7,代码来源:FormMapper.php

示例7: getPersonForm

 private function getPersonForm(FormBuilderInterface $formBuilder, Person $person)
 {
     if ($formBuilder->has('person') === false) {
         $formBuilder->add('person', new DynamicPersonType(), array('label' => false));
     }
     return $formBuilder->get('person');
 }
开发者ID:hacklabr,项目名称:login-cidadao,代码行数:7,代码来源:DynamicFormController.php


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