本文整理汇总了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;
}
示例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());
}
}
示例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());
}
}
示例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());
}
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例8: setValue
/**
* {@inheritdoc}
*/
public function setValue($record)
{
$this->latField->setValue($record['Latitude']);
$this->lngField->setValue($record['Longitude']);
$this->zoomField->setValue($record['Zoom']);
return $this;
}
示例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);
}
示例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...");
}
}
示例12: setValue
function setValue($data)
{
if ($this->buyable) {
$value = $this->buyable->FullName ? $this->buyable->FullName : $this->buyable->getTitle();
//to TEST!!!
$this->fieldSelectedBuyable->setValue($value);
}
}
示例13: setValue
public function setValue($value)
{
if ($value instanceof EmbeddedObject) {
$this->object = $value;
parent::setValue($value->toMap());
}
parent::setValue($value);
}
示例14: setValue
function setValue($value)
{
if (!is_array($value)) {
$this->valueArray = explode(',', $value);
} else {
$this->valueArray = $value;
}
return parent::setValue($value);
}
示例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;
}