--- mailchimp.module
+++ (clipboard)
@@ -435,9 +435,9 @@
function mailchimp_subscribe_form() {
global $user;
-
+
if ($user->uid) {
- drupal_set_message(t('You can manage your newsletter subscriptions from your '. l('user account page', 'user') .'.'));
+ drupal_set_message(t('You can manage your newsletter subscriptions from your user account page.', array('!account_url' => url('user'))));
}
else {
if ($q = _mailchimp_get_api_object()) {
@@ -460,10 +460,7 @@
);
foreach ((array)$q->listMergeVars($list['id']) as $mergevar) {
- $form['list_'. $list['id']][$mergevar['tag']] = array(
- '#type' => 'textfield',
- '#title' => $mergevar['name'],
- );
+ $form['list_'. $list['id']][$mergevar['tag']] = _mailchimp_insert_drupal_form_tag($mergevar);
}
if ($intgroup = $q->listInterestGroups($list['id'])) {
@@ -489,6 +486,55 @@
}
}
+function _mailchimp_insert_drupal_form_tag($mergevar) {
+
+ // Insert common FormAPI properties
+ $input = array(
+ '#title' => $mergevar['name'],
+ '#weight' => $mergevar['order'],
+ '#required' => $mergevar['req'],
+ '#default_value' => $mergevar['default'],
+ );
+
+ switch ($mergevar['field_type']) {
+ case 'dropdown':
+ // dropdown is mapped to