本文整理匯總了PHP中DropdownField::getName方法的典型用法代碼示例。如果您正苦於以下問題:PHP DropdownField::getName方法的具體用法?PHP DropdownField::getName怎麽用?PHP DropdownField::getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DropdownField
的用法示例。
在下文中一共展示了DropdownField::getName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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