You are here

function node_registration_send_mail_action_form in Node registration 7

Action mail form.

File

includes/node_registration.forms.inc, line 80
New registration forms. Public and admin.

Code

function node_registration_send_mail_action_form($context, $form_state) {
  $values = $form_state['values'];
  $selection = array_filter($values['views_bulk_operations']);
  $form = array();
  $registrations = node_registration_load_multiple($selection);
  $form['#registrations'] = $registrations;
  $form['recipients'] = array(
    '#type' => 'item',
    '#title' => t('Recipients'),
    '#markup' => count($registrations),
  );
  $form['recipientfield'] = array(
    '#type' => 'textfield',
    '#title' => t('Recipient field (token)'),
    '#default_value' => '[node-registration:email]',
    '#required' => TRUE,
  );
  $form['bcc'] = array(
    '#type' => 'textfield',
    '#title' => t('Send BCC to'),
    '#element_validate' => array(
      'value_is_email',
    ),
    '#max' => 20,
  );
  $form['message'] = array(
    '#type' => 'fieldset',
    '#title' => t('Message'),
  );
  $form['message']['subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#required' => TRUE,
  );
  $form['message']['message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message'),
    '#required' => TRUE,
    '#cols' => '80',
    '#rows' => '10',
  );

  /*$form['attachments'] = array(
      '#type' => 'file',
      '#title' => t('Attachments'),
      '#name' => 'attachments[]',
      '#attributes' => array('multiple' => ''),
    );*/
  $form['from'] = array(
    '#type' => 'fieldset',
    '#title' => t('From'),
  );
  $form['from']['from_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#required' => TRUE,
    '#default_value' => _node_registration_default_from_name(),
  );
  $form['from']['from_email'] = array(
    '#type' => 'textfield',
    '#title' => t('E-mail'),
    '#required' => TRUE,
    '#element_validate' => array(
      'value_is_email',
    ),
    '#default_value' => variable_get('site_mail'),
  );
  return $form;
}