本文整理汇总了PHP中FormField::Value方法的典型用法代码示例。如果您正苦于以下问题:PHP FormField::Value方法的具体用法?PHP FormField::Value怎么用?PHP FormField::Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormField
的用法示例。
在下文中一共展示了FormField::Value方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveInto
/**
* SaveInto checks if set-methods are available and use them instead of setting the values directly. saveInto
* initiates a new LinkField class object to pass through the values to the setter method.
*/
public function saveInto(DataObjectInterface $dataObject)
{
$fieldName = $this->name;
if ($dataObject->hasMethod("set{$fieldName}")) {
$dataObject->{$fieldName} = DBField::create('LinkField', array("PageID" => $this->fieldPageID->Value(), "CustomURL" => $this->fieldCustomURL->Value()));
} else {
$dataObject->{$fieldName}->setPageID($this->fieldPageID->Value());
$dataObject->{$fieldName}->setCustomURL($this->fieldCustomURL->Value());
}
}
示例2: saveInto
/**
* 30/06/2009 - Enhancement:
* SaveInto checks if set-methods are available and use them
* instead of setting the values in the money class directly. saveInto
* initiates a new Money class object to pass through the values to the setter
* method.
*
*/
function saveInto(DataObjectInterface $dataObject)
{
$fieldName = $this->name;
if ($dataObject->hasMethod("set{$fieldName}")) {
$dataObject->{$fieldName} = DBField::create_field('WTLink', array("Type" => $this->fieldType->Value(), "Internal" => $this->internalField->Value(), "External" => $this->externalField->Value(), "Email" => $this->emailField->Value(), "File" => $this->fileField->Value(), "TargetBlank" => $this->targetBlankField->Value()));
} else {
if (!empty($dataObject->{$fieldName})) {
$dataObject->{$fieldName}->setType($this->fieldType->Value());
$dataObject->{$fieldName}->setInternal($this->internalField->Value());
$dataObject->{$fieldName}->setExternal($this->externalField->Value());
$dataObject->{$fieldName}->setEmail($this->emailField->Value());
$dataObject->{$fieldName}->setFile($this->fileField->Value());
$dataObject->{$fieldName}->setTargetBlank($this->targetBlankField->Value());
}
}
}
示例3: saveInto
/**
* 30/06/2009 - Enhancement:
* SaveInto checks if set-methods are available and use them
* instead of setting the values in the money class directly. saveInto
* initiates a new Money class object to pass through the values to the setter
* method.
*
* (see @link MoneyFieldTest_CustomSetter_Object for more information)
*/
public function saveInto(DataObjectInterface $dataObject)
{
$fieldName = $this->name;
if ($dataObject->hasMethod("set{$fieldName}")) {
$dataObject->{$fieldName} = DBField::create_field('Location', array("Latitude" => $this->fieldLatitude->Value(), "Longditude" => $this->fieldLongditude->Value()));
} else {
$dataObject->{$fieldName}->setLatitude($this->fieldLatitude->Value());
$dataObject->{$fieldName}->setLongditude($this->fieldLongditude->Value());
}
}
示例4:
/**
* Create a new nullable field
* @param $valueField
* @return NullableField
*/
function __construct(FormField $valueField, $isNullLabel = null)
{
$this->valueField = $valueField;
$this->isNullLabel = $isNullLabel;
if (is_null($this->isNullLabel)) {
// Set a default label if one is not provided.
$this->isNullLabel = _t('NullableField.IsNullLabel', 'Is Null');
}
parent::__construct($valueField->getName(), $valueField->Title(), $valueField->Value(), $valueField->getForm(), $valueField->RightTitle());
$this->readonly = $valueField->isReadonly();
}
示例5: __construct
/**
* Create a new nullable field
*
* @param FormField $valueField
* @param null|string $isNullLabel
*/
public function __construct(FormField $valueField, $isNullLabel = null)
{
$this->valueField = $valueField;
if (isset($isNullLabel)) {
$this->setIsNullLabel($isNullLabel);
} else {
$this->isNullLabel = _t('NullableField.IsNullLabel', 'Is Null');
}
parent::__construct($valueField->getName(), $valueField->Title(), $valueField->Value());
$this->setForm($valueField->getForm());
$this->setRightTitle($valueField->RightTitle());
$this->setReadonly($valueField->isReadonly());
}
示例6: saveInto
/**
* SaveInto checks if set-methods are available and use them instead of setting the values directly. saveInto
* initiates a new LinkField class object to pass through the values to the setter method.
*/
public function saveInto(DataObjectInterface $dataObject)
{
$fieldName = $this->name;
if ($dataObject->hasMethod("set{$fieldName}")) {
$dataObject->{$fieldName} = DBField::create('NamedLinkField', array("PageID" => $this->fieldPageID->Value(), "CustomURL" => $this->fieldCustomURL->Value(), "Title" => $this->fieldTitle->Value(), "Linkmode" => $this->fieldLinkmode->Value()));
} else {
if (!is_object($dataObject->{$fieldName})) {
$dataObject->{$fieldName} = NamedLinkField::create();
}
$dataObject->{$fieldName}->setPageID($this->fieldPageID->Value());
$dataObject->{$fieldName}->setCustomURL($this->fieldCustomURL->Value());
$dataObject->{$fieldName}->setTitle($this->fieldTitle->Value());
$dataObject->{$fieldName}->setLinkmode($this->fieldLinkmode->Value());
}
}
示例7: augmentMailChimpField
protected function augmentMailChimpField(FormField $field, string $component, FlexiFormMailChimpClient $client)
{
switch ($component) {
case 'MailChimpSendWelcome':
$field->setTitle('Send Welcome Email');
$field->description = 'flag to control whether the Welcome Email is sent. Has no effect if double opt-in is enabled.';
break;
case 'MailChimpDoubleOptIn':
$field->setTitle('Require Double Opt-In');
$field->description = 'flag to control whether a double opt-in confirmation message is sent, defaults to true. Abusing this may cause your account to be suspended.';
break;
case 'MailChimpEmailField':
$field->setTitle('Subscription Field');
$field->description = 'Used as the subscriber email. Must be an Email Field or subclass.';
break;
case 'MailChimpEmailType':
// @TODO ought to let user select preference through a form field [ similar to interest groups? ]
$field->setTitle('Email Preference');
$field->description = 'email type preference for subscribers (html or text - defaults to html)';
break;
case 'MailChimpApiKey':
if ($client->isApiKeyValid()) {
$field->description = 'This API Key is Valid.';
} else {
if ($client->getApiKey() == '') {
$field->description = 'Your MailChimp API Key. Found under Account Extras > Your API Keys';
} else {
$field->description = 'This API Key is not Valid.';
}
}
$field->setTitle('MailChimp API Key');
break;
case 'MailChimpListID':
if ($lists = $client->getLists(array('limit' => 100, 'sort_field' => 'web'))) {
$value = $field->Value();
$source = array('' => 'Please Select a List');
$field = new DropdownField($field->getName());
$field->description = 'Subscribers will be added to this list. Lists are refreshed every 10 minutes.';
if ($lists['total'] > 0) {
foreach ($lists['data'] as $list) {
$source[$list['id']] = $list['name'];
}
}
$field->setValue($value);
$field->setSource($source);
} else {
$field = $field->performReadonlyTransformation();
if (!$client->isApiKeyValid()) {
$field->setValue('Invalid API Key');
} else {
$field->setValue('Error loading Lists from your Account');
}
}
$field->setTitle('MailChimp List ID');
break;
}
return $field;
}
开发者ID:helpfulrobot,项目名称:briceburg-silverstripe-mailchimp-flexiform,代码行数:58,代码来源:FlexiFormMailChimpHandler.php