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


PHP FormField::setValue方法代码示例

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


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

示例1: setValue

 /**
  * {@inheritdoc}
  */
 public function setValue($value, $data = null)
 {
     if (is_array($value) && isset($value['Geometry'])) {
         $this->geometryField->setValue($value['Geometry']);
     } elseif (is_string($value)) {
         $this->geometryField->setValue($value);
     }
     return $this;
 }
开发者ID:helpfulrobot,项目名称:benmanu-silverstripe-leafletfield,代码行数:12,代码来源:LeafletField.php

示例2: setValue

 public function setValue($val)
 {
     $this->value = $val;
     if (is_array($val)) {
         $this->fieldPageID->setValue($val['PageID']);
         $this->fieldCustomURL->setValue($val['CustomURL']);
     } elseif ($val instanceof LinkField) {
         $this->fieldPageID->setValue($val->getPageID());
         $this->fieldCustomURL->setValue($val->getCustomURL());
     }
 }
开发者ID:helpfulrobot,项目名称:lrc-silverstripe-link-field,代码行数:11,代码来源:LinkFormField.php

示例3: setValue

 public function setValue($val)
 {
     $this->value = $val;
     if (is_array($val)) {
         $this->fieldLatitude->setValue($val['Latitude']);
         $this->fieldLongditude->setValue($val['Longditude']);
         $this->fieldPositionSet->setValue($val['PositionSet']);
     } elseif ($val instanceof Location) {
         $this->fieldLatitude->setValue($val->getLatitude());
         $this->fieldLongditude->setValue($val->getLongditude());
     }
 }
开发者ID:helpfulrobot,项目名称:andrelohmann-silverstripe-geoform,代码行数:12,代码来源:HiddenLocationField.php

示例4: setValue

 public function setValue($val)
 {
     $this->value = $val;
     if (is_array($val)) {
         $this->fieldPageID->setValue($val['PageID']);
         $this->fieldCustomURL->setValue($val['CustomURL']);
         $this->fieldTitle->setValue($val['Title']);
         $this->fieldLinkmode->setValue($val['Linkmode']);
     } elseif ($val instanceof NamedLinkField) {
         $this->fieldPageID->setValue($val->getPageID());
         $this->fieldCustomURL->setValue($val->getCustomURL());
         $this->fieldTitle->setValue($val->getTitle());
         $this->fieldLinkmode->setValue($val->getLinkmode());
     }
 }
开发者ID:helpfulrobot,项目名称:micschk-silverstripe-namedlinkfield,代码行数:15,代码来源:NamedLinkFormField.php

示例5: setValue

 /**
  * Sets the value of the field.
  *
  * @param string $value The value of the field
  *
  * @throws \InvalidArgumentException When value type provided is not correct
  */
 public function setValue($value)
 {
     if ('checkbox' == $this->type && false === $value) {
         // uncheck
         $this->value = null;
     } elseif ('checkbox' == $this->type && true === $value) {
         // check
         $this->value = $this->options[0];
     } else {
         if (is_array($value)) {
             if (!$this->multiple) {
                 throw new \InvalidArgumentException(sprintf('The value for "%s" cannot be an array.', $this->name));
             }
             foreach ($value as $v) {
                 if (!in_array($v, $this->options)) {
                     throw new \InvalidArgumentException(sprintf('Input "%s" cannot take "%s" as a value (possible values: %s).', $this->name, $v, implode(', ', $this->options)));
                 }
             }
         } elseif (!in_array($value, $this->options)) {
             throw new \InvalidArgumentException(sprintf('Input "%s" cannot take "%s" as a value (possible values: %s).', $this->name, $value, implode(', ', $this->options)));
         }
         if ($this->multiple && !is_array($value)) {
             $value = array($value);
         }
         if (is_array($value)) {
             $this->value = $value;
         } else {
             parent::setValue($value);
         }
     }
 }
开发者ID:robo47,项目名称:symfony,代码行数:38,代码来源:ChoiceFormField.php

示例6: setValue

 public function setValue($val)
 {
     $this->value = $val;
     if (is_array($val)) {
         $this->fieldType->setValue($val['Type']);
         $this->internalField->setValue($val['Internal']);
         $this->externalField->setValue($val['External']);
         $this->emailField->setValue($val['Email']);
         $this->fileField->setValue($val['File']);
         $this->anchorField->setValue($val['Anchor']);
         $this->targetBlankField->setValue(isset($val['TargetBlank']) ? $val['TargetBlank'] : false);
         $this->extraField->setValue($val['Extra']);
         $this->dataObjectField->setValue($val['DataObject']);
     } elseif ($val instanceof WTLink) {
         $this->fieldType->setValue($val->getType());
         $this->internalField->setValue($val->getInternal());
         $this->externalField->setValue($val->getExternal());
         $this->emailField->setValue($val->getEmail());
         $this->fileField->setValue($val->getFile());
         $this->anchorField->setValue($val->getAnchor());
         $this->targetBlankField->setValue($val->getTargetBlank());
         $this->extraField->setValue($val->getExtra());
         $this->dataObjectField->setValue($val->getDataObject());
     }
     return $this;
 }
开发者ID:webtorque7,项目名称:link-field,代码行数:26,代码来源:WTLinkField.php

示例7: setValue

 /**
  * define input values
  *
  * @param $values
  *
  * @since 1.0.0
  */
 public function setValue($values)
 {
     if (is_string($values)) {
         $values = explode(",", $values);
     }
     parent::setValue($values);
 }
开发者ID:cyan-framework,项目名称:library,代码行数:14,代码来源:checkbox.php

示例8: setValue

 /**
  * {@inheritdoc}
  */
 public function setValue($record)
 {
     $this->latField->setValue($record['Latitude']);
     $this->lngField->setValue($record['Longitude']);
     $this->zoomField->setValue($record['Zoom']);
     return $this;
 }
开发者ID:helpfulrobot,项目名称:betterbrief-silverstripe-googlemapfield,代码行数:10,代码来源:GoogleMapField.php

示例9: setValue

 /**
  * @param array|object $value
  */
 public function setValue($value)
 {
     if (is_object($value)) {
         $value = $value->map('ID', 'Quantity');
     }
     parent::setValue($value);
 }
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-eventmanagement,代码行数:10,代码来源:EventRegistrationTicketsTableField.php

示例10: setValue

 /**
  * Value is sometimes an array, and sometimes a single value, so we need to handle both cases
  */
 function setValue($value, $data = null)
 {
     if (is_array($data) && array_key_exists($this->getIsNullId(), $data) && $data[$this->getIsNullId()]) {
         $value = null;
     }
     $this->valueField->setValue($value);
     parent::setValue($value);
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:11,代码来源:NullableField.php

示例11: setValue

 /**
  * Do we do anything with data???
  */
 function setValue($data)
 {
     if ($this->buyable) {
         $value = $this->buyable->FullName ? $this->buyable->FullName : $this->buyable->getTitle();
         //to TEST!!!
         $this->fieldSelectedBuyable->setValue("Once you have selected a new value, it will appear here...");
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:11,代码来源:BuyableSelectField.php

示例12: setValue

 function setValue($data)
 {
     if ($this->buyable) {
         $value = $this->buyable->FullName ? $this->buyable->FullName : $this->buyable->getTitle();
         //to TEST!!!
         $this->fieldSelectedBuyable->setValue($value);
     }
 }
开发者ID:nieku,项目名称:silverstripe-ecommerce,代码行数:8,代码来源:BuyableSelectField.php

示例13: setValue

 public function setValue($value)
 {
     if ($value instanceof EmbeddedObject) {
         $this->object = $value;
         parent::setValue($value->toMap());
     }
     parent::setValue($value);
 }
开发者ID:jason-zz,项目名称:silverstripe-linkable,代码行数:8,代码来源:EmbeddedObjectField.php

示例14: setValue

 function setValue($value)
 {
     if (!is_array($value)) {
         $this->valueArray = explode(',', $value);
     } else {
         $this->valueArray = $value;
     }
     return parent::setValue($value);
 }
开发者ID:helpfulrobot,项目名称:silverstripers-silverstripe-postmarked,代码行数:9,代码来源:ObjectSelectorField.php

示例15: setAllowedCurrencies

 /**
  * @param array $arr
  * @return $this
  */
 public function setAllowedCurrencies($arr)
 {
     $this->allowedCurrencies = $arr;
     // @todo Has to be done twice in case allowed currencies changed since construction
     $oldVal = $this->fieldCurrency->dataValue();
     $this->fieldCurrency = $this->buildCurrencyField();
     $this->fieldCurrency->setValue($oldVal);
     return $this;
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:13,代码来源:MoneyField.php


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