You are here

function mailing_list_subscription_form in Mailing List 6

Same name and namespace in other branches
  1. 7 mailing_list.module \mailing_list_subscription_form()

Display a form letting a user subscribe to a mailing list.

1 string reference to 'mailing_list_subscription_form'
mailing_list_forms in ./mailing_list.module
Implementation of hook_forms().

File

./mailing_list.module, line 233
Minimalistic mailing list module.

Code

function mailing_list_subscription_form(&$form_state, $list) {
  $form = array();
  $form['mlid'] = array(
    '#type' => 'hidden',
    '#default_value' => $list->mlid,
  );
  $form['ml_name'] = array(
    '#type' => 'hidden',
    '#value' => $list->name,
  );
  if (variable_get('mailing_list_show_name_' . $list->mlid, 1)) {
    $form['name'] = array(
      '#title' => t('Name'),
      '#type' => 'textfield',
      '#size' => 20,
      '#required' => TRUE,
    );
  }
  else {
    $form['name'] = array(
      '#type' => 'hidden',
      '#value' => '',
    );
  }
  $form['mail'] = array(
    '#title' => t('E-mail'),
    '#type' => 'textfield',
    '#size' => 20,
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#value' => t('Subscribe'),
    '#type' => 'submit',
    '#submit' => array(
      'mailing_list_subscription_form_submit',
    ),
  );
  $form['#validate'] = array(
    'mailing_list_subscription_form_validate',
  );
  return $form;
}