function mailchimp_subscribe_anon_form_all in Mailchimp 6.2
Same name and namespace in other branches
- 7 mailchimp.module \mailchimp_subscribe_anon_form_all()
Return a form for all available MC lists
Parameters
<type> $form_state:
<type> $list MC list object:
<type> $q MC object:
Return value
<type> form array
1 string reference to 'mailchimp_subscribe_anon_form_all'
- mailchimp_subscribe_page in ./
mailchimp.module - Return all available MC lists a given user can subscribe to
File
- ./
mailchimp.module, line 497 - Mailchimp module.
Code
function mailchimp_subscribe_anon_form_all($form_state, $q) {
$form = array(
'#tree' => TRUE,
);
global $user;
$lists = _mailchimp_get_available_lists($user);
foreach ($lists as $list) {
$form['mailchimp_lists'][$list->id] = array(
'#type' => 'fieldset',
'#title' => t($list->name),
'#description' => t($list->description),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
_mailchimp_subscribe_anon_form($list, $q, $form['mailchimp_lists'][$list->id]);
// for anonymous sign up forms, we want to force email to be optional
if ($form['mailchimp_lists'][$list->id]['EMAIL']) {
$form['mailchimp_lists'][$list->id]['EMAIL']['#required'] = FALSE;
}
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Sign Up!'),
'#weight' => 100,
);
$form['#submit'][] = 'mailchimp_subscribe_anon_form_submit';
return $form;
}