You are here

function campaignmonitor_form_alter in Campaign Monitor 5.2

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

Implementation of hook_form_alter()

File

./campaignmonitor.module, line 78

Code

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