You are here

function campaignmonitor_form_alter in Campaign Monitor 6

Same name and namespace in other branches
  1. 5.2 campaignmonitor.module \campaignmonitor_form_alter()
  2. 5 campaignmonitor.module \campaignmonitor_form_alter()
  3. 6.3 campaignmonitor.module \campaignmonitor_form_alter()
  4. 6.2 campaignmonitor.module \campaignmonitor_form_alter()

File

./campaignmonitor.module, line 46

Code

function campaignmonitor_form_alter(&$form, $form_state, $form_id) {
  $display_on = variable_get('campaignmonitor_display_on', array());
  if ('contact_mail_page' == $form_id && $display_on['contact'] == 'contact' || 'user_register' == $form_id && $display_on['registration'] == 'registration' && user_access('join newsletter')) {
    $form['subscribe_newsletter'] = array(
      '#type' => 'checkbox',
      '#title' => t(variable_get('campaignmonitor_checkboxdisplaytext', 'Join our Newsletter?')),
      '#weight' => 99,
      '#default_value' => 1,
    );
    $form['submit']['#weight'] = 100;
    $form['#submit'] = array(
      '_campaignmonitor_form_submit' => array(),
    ) + (array) $form['#submit'];
  }
}