當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Element::setOptions方法代碼示例

本文整理匯總了PHP中Zend\Form\Element::setOptions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Element::setOptions方法的具體用法?PHP Element::setOptions怎麽用?PHP Element::setOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Form\Element的用法示例。


在下文中一共展示了Element::setOptions方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setOptions

 public function setOptions($options)
 {
     parent::setOptions($options);
     if (isset($options['form'])) {
         $this->setForm($options['form']);
     }
 }
開發者ID:cross-solution,項目名稱:yawik,代碼行數:7,代碼來源:DisableElementsCapableFormSettings.php

示例2: setOptions

 /**
  * Set options for a fieldset. Accepted options are:
  * - use_as_base_fieldset: is this fieldset use as the base fieldset?
  *
  * @param  array|Traversable $options
  * @return Element|ElementInterface
  * @throws Exception\InvalidArgumentException
  */
 public function setOptions($options)
 {
     parent::setOptions($options);
     if (isset($options['use_as_base_fieldset'])) {
         $this->setUseAsBaseFieldset($options['use_as_base_fieldset']);
     }
     return $this;
 }
開發者ID:gstearmit,項目名稱:EshopVegeTable,代碼行數:16,代碼來源:Fieldset.php

示例3: setOptions

 /**
  * Accepted options for DateTime:
  * - format: A \DateTime compatible string
  *
  * @param array|\Traversable $options
  * @return DateTime
  */
 public function setOptions($options)
 {
     parent::setOptions($options);
     if (isset($this->options['format'])) {
         $this->setFormat($this->options['format']);
     }
     return $this;
 }
開發者ID:mindfeederllc,項目名稱:openemr,代碼行數:15,代碼來源:DateTime.php

示例4: setOptions

 /**
  * Accepted options for Captcha:
  * - captcha: a valid Zend\Captcha\AdapterInterface
  *
  * @param array|Traversable $options
  * @return Captcha
  */
 public function setOptions($options)
 {
     parent::setOptions($options);
     if (isset($this->options['captcha'])) {
         $this->setCaptcha($this->options['captcha']);
     }
     return $this;
 }
開發者ID:Flesh192,項目名稱:magento,代碼行數:15,代碼來源:Captcha.php

示例5: setOptions

 /**
  * Accepted options for Csrf:
  * - csrf_options: an array used in the Csrf
  *
  * @param array|\Traversable $options
  * @return Csrf
  */
 public function setOptions($options)
 {
     parent::setOptions($options);
     if (isset($options['csrf_options'])) {
         $this->setCsrfValidatorOptions($options['csrf_options']);
     }
     return $this;
 }
開發者ID:eltondias,項目名稱:Relogio,代碼行數:15,代碼來源:Csrf.php

示例6: addElement

 /**
  * @param Element $element
  */
 public function addElement($element)
 {
     $options = $element->getOptions();
     $options['displayGroup'] = $this->getName();
     $element->setOptions($options);
     $this->elements[$element->getName()] = $element;
     return $this;
 }
開發者ID:NguyenQuiDuong,項目名稱:Funixtest,代碼行數:11,代碼來源:DisplayGroup.php

示例7: testCanCreateLabelValueAfterInput

 public function testCanCreateLabelValueAfterInput()
 {
     $element = new Element('foo');
     $element->setOptions(array('label' => 'The value for foo:'));
     $this->helper->setLabelPosition('append');
     $markup = $this->helper->render($element);
     $this->assertContains('<label><input', $markup);
     $this->assertContains('</label>', $markup);
 }
開發者ID:razvansividra,項目名稱:pnlzf2-1,代碼行數:9,代碼來源:FormRowTest.php

示例8: setOptions

 /**
  * Set options for a fieldset. Accepted options are:
  * - use_as_base_fieldset: is this fieldset use as the base fieldset?
  *
  * @param  array|Traversable $options
  * @return Element|ElementInterface
  * @throws Exception\InvalidArgumentException
  */
 public function setOptions($options)
 {
     parent::setOptions($options);
     if (isset($options['use_as_base_fieldset'])) {
         $this->setUseAsBaseFieldset($options['use_as_base_fieldset']);
     }
     if (isset($options['allowed_object_binding_class'])) {
         $this->setAllowedObjectBindingClass($options['allowed_object_binding_class']);
     }
     return $this;
 }
開發者ID:robertboloc,項目名稱:zf2,代碼行數:19,代碼來源:Fieldset.php

示例9: setOptions

 /**
  * Set options for an element. Accepted options are:
  * - label: label to associate with the element
  * - label_attributes: attributes to use when the label is rendered
  * - value_options: list of values and labels for the select options
  *
  * @param  array|\Traversable $options
  * @return Select|ElementInterface
  * @throws Exception\InvalidArgumentException
  */
 public function setOptions($options)
 {
     parent::setOptions($options);
     if (isset($this->options['value_options'])) {
         $this->setValueOptions($this->options['value_options']);
     }
     // Alias for 'value_options'
     if (isset($this->options['options'])) {
         $this->setValueOptions($this->options['options']);
     }
     return $this;
 }
開發者ID:nuxwin,項目名稱:zf2,代碼行數:22,代碼來源:Select.php

示例10: setOptions

 /**
  * reCAPTCHA options
  * - site_key: Public key (html)
  * - secret_key: Private key
  * - remote_ip: Check IP
  *
  * @param  array|\Traversable $options
  * @return self
  * @throws Exception\InvalidArgumentException
  */
 public function setOptions($options)
 {
     parent::setOptions($options);
     if (empty($options['site_key']) || empty($options['secret_key'])) {
         throw new Exception\InvalidArgumentException('The options site_key and/or secret_key were not found');
     }
     $this->setSiteKey($options['site_key']);
     $this->setSecretKey($options['secret_key']);
     if (isset($options['remote_ip'])) {
         $this->setRemoteIp($options['remote_ip']);
     }
     return $this;
 }
開發者ID:basselin,項目名稱:zf2-new-recaptcha,代碼行數:23,代碼來源:NewReCaptcha.php

示例11: setOptions

 /**
  * Accepted options for MultiCheckbox:
  * - use_hidden_element: do we render hidden element?
  * - unchecked_value: value for checkbox when unchecked
  * - checked_value: value for checkbox when checked
  *
  * @param  array|\Traversable $options
  * @return Checkbox
  */
 public function setOptions($options)
 {
     parent::setOptions($options);
     if (isset($options['use_hidden_element'])) {
         $this->setUseHiddenElement($options['use_hidden_element']);
     }
     if (isset($options['unchecked_value'])) {
         $this->setUncheckedValue($options['unchecked_value']);
     }
     if (isset($options['checked_value'])) {
         $this->setCheckedValue($options['checked_value']);
     }
     return $this;
 }
開發者ID:Rovak,項目名稱:zf2,代碼行數:23,代碼來源:Checkbox.php

示例12: setOptions

 /**
  * Accepted options for DoctrineEntity:
  * - object_manager: a valid Doctrine 2 ObjectManager
  * - target_class: a FQCN of the target entity
  * - property: the property of the entity to use as the label in the options
  * - spec: a closure, QueryBuilder or Query
  *
  * @param  array|\Traversable $options
  * @return DoctrineEntity
  */
 public function setOptions($options)
 {
     parent::setOptions($options);
     if (isset($options['object_manager'])) {
         $this->setObjectManager($options['object_manager']);
     }
     if (isset($options['target_class'])) {
         $this->setTargetClass($options['target_class']);
     }
     if (isset($options['property'])) {
         $this->setProperty($options['property']);
     }
     if (isset($options['spec'])) {
         $this->setSpec($options['spec']);
     }
     return $this;
 }
開發者ID:ashimidashajia,項目名稱:zendstore,代碼行數:27,代碼來源:DoctrineEntity.php

示例13: setOptions

 /**
  * Set options for an element. Accepted options are:
  * - label: label to associate with the element
  * - label_attributes: attributes to use when the label is rendered
  * - value_options: list of values and labels for the select options
  * _ empty_option: should an empty option be prepended to the options ?
  *
  * @param  array|Traversable $options
  * @return Select|ElementInterface
  * @throws InvalidArgumentException
  */
 public function setOptions($options)
 {
     parent::setOptions($options);
     if (isset($this->options['value_options'])) {
         $this->setValueOptions($this->options['value_options']);
     }
     // Alias for 'value_options'
     if (isset($this->options['options'])) {
         $this->setValueOptions($this->options['options']);
     }
     if (isset($this->options['empty_option'])) {
         $this->setEmptyOption($this->options['empty_option']);
     }
     if (isset($this->options['disable_inarray_validator'])) {
         $this->setDisableInArrayValidator($this->options['disable_inarray_validator']);
     }
     return $this;
 }
開發者ID:eltondias,項目名稱:Relogio,代碼行數:29,代碼來源:Select.php

示例14: setOptions

 public function setOptions($options)
 {
     parent::setOptions($options);
     if (isset($options['startdate'])) {
         if (isset($options['startdate']['options'])) {
             $this->getStartDateElement()->setOptions($options['startdate']['options']);
         }
         if (isset($options['startdate']['attributes'])) {
             $this->getStartDateElement()->setAttributes($options['startdate']['attributes']);
         }
     }
     if (isset($options['enddate'])) {
         if (isset($options['enddate']['options'])) {
             $this->getEndDateElement()->setOptions($options['enddate']['options']);
         }
         if (isset($options['enddate']['attributes'])) {
             $this->getEndDateElement()->setAttributes($options['enddate']['attributes']);
         }
     }
 }
開發者ID:webpants,項目名稱:YAWIK,代碼行數:20,代碼來源:DateRange.php

示例15: getForm

 public function getForm($article, $entityManager, $myEntity, $action)
 {
     $builder = new DoctrineAnnotationBuilder($entityManager);
     $form = $builder->createForm($article);
     //!!!!!! Start !!!!! Added to make the association tables work with select
     foreach ($form->getElements() as $element) {
         if (method_exists($element, 'getProxy')) {
             $proxy = $element->getProxy();
             if (method_exists($proxy, 'setObjectManager')) {
                 $proxy->setObjectManager($entityManager);
             }
         }
     }
     $form->setHydrator(new DoctrineHydrator($entityManager, $myEntity));
     $oName = new Element('name');
     $oName->setAttributes(array('type' => 'text', 'maxlength' => 255));
     $oName->setOptions(array('label' => 'Название'));
     $form->add($oName, array('priority' => 1000));
     $oDescription = new Element('description');
     $oDescription->setAttributes(array('type' => 'text', 'maxlength' => 255));
     $oDescription->setOptions(array('label' => 'Описание'));
     $form->add($oDescription, array('priority' => 999));
     $send = new Element('send');
     $send->setValue($action);
     // submit
     $send->setAttributes(array('type' => 'submit'));
     $form->add($send);
     foreach ($form->getElements() as $element) {
         $element->setAttribute('id', $element->getName());
         $element->setAttribute('class', 'form-control');
         /*if ($element->getLabel() === null) {
               $element->setOptions(array('add-on-div' => array('class'  => 'col-sm-offset-2 col-sm-10'), ));
           } else {
               $element->setOptions(array( 'add-on-div' => array('class'  => 'col-sm-10'), 
                                       'label_attributes' => array('class'  => 'col-sm-2 control-label'),
                                 ));
           }*/
     }
     return $form;
 }
開發者ID:sudar69,項目名稱:hermes,代碼行數:40,代碼來源:WidgetForm.php


注:本文中的Zend\Form\Element::setOptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。