本文整理汇总了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