You are here

function mailchimp_lists_forms in Mailchimp 7.4

Same name and namespace in other branches
  1. 7.5 modules/mailchimp_lists/mailchimp_lists.module \mailchimp_lists_forms()
  2. 7.2 modules/mailchimp_lists/mailchimp_lists.module \mailchimp_lists_forms()
  3. 7.3 modules/mailchimp_lists/mailchimp_lists.module \mailchimp_lists_forms()

Implements hook_forms().

This allows each field's subscription-form rendering to have a unique form ID. If this weren't the case, multiple forms getting rendered on a single entity display would have submit button conflicts.

File

modules/mailchimp_lists/mailchimp_lists.module, line 131

Code

function mailchimp_lists_forms($form_id, $args) {
  $forms = array();
  if (strpos($form_id, 'mailchimp_lists_') === 0 && isset($args[3]['type']) && $args[3]['type'] == "mailchimp_lists_subscription") {
    $forms['mailchimp_lists_' . $args[0]['field_name'] . '_form'] = array(
      'callback' => 'mailchimp_lists_subscribe_form',
    );
  }
  return $forms;
}