You are here

function mailchimp_signup_forms in Mailchimp 7.3

Same name and namespace in other branches
  1. 7.5 modules/mailchimp_signup/mailchimp_signup.module \mailchimp_signup_forms()
  2. 7.4 modules/mailchimp_signup/mailchimp_signup.module \mailchimp_signup_forms()

Implements hook_forms().

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

File

modules/mailchimp_signup/mailchimp_signup.module, line 239
Mailchimp Signup module. Allows creation of signup forms integrated with Mailchimp.

Code

function mailchimp_signup_forms($form_id, $args) {
  $forms = array();
  if (strpos($form_id, 'mailchimp_') === 0 && isset($args[1])) {
    if ($args[1] == 'mailchimp_signup_page') {
      $forms['mailchimp_signup_subscribe_page_' . $args[0]->name . '_form'] = array(
        'callback' => 'mailchimp_signup_subscribe_form',
      );
    }
    if ($args[1] == 'mailchimp_signup_block') {
      $forms['mailchimp_signup_subscribe_block_' . $args[0]->name . '_form'] = array(
        'callback' => 'mailchimp_signup_subscribe_form',
      );
    }
  }
  return $forms;
}