You are here

function library_send_email_action_form in Library 6

Same name and namespace in other branches
  1. 5.2 library.actions.inc \library_send_email_action_form()
  2. 6.2 library.actions.inc \library_send_email_action_form()
  3. 7 library.actions.inc \library_send_email_action_form()

Return a form definition so the Send email action can be configured.

Parameters

$context: Default values (if we are editing an existing action instance).

Return value

Form definition.

See also

library_send_email_action_validate()

library_send_email_action_submit()

File

./library.actions.inc, line 137
Hooks into core Drupal actions module

Code

function library_send_email_action_form($context) {

  // Set default values for form.
  if (!isset($context['recipient'])) {
    $context['recipient'] = '';
  }
  if (!isset($context['subject'])) {
    $context['subject'] = '';
  }
  if (!isset($context['message'])) {
    $context['message'] = '';
  }
  $form['recipient'] = array(
    '#type' => 'textfield',
    '#title' => t('Recipient'),
    '#default_value' => $context['recipient'],
    '#maxlength' => '254',
    '#description' => t('The email address to which the message should be sent.'),
  );
  $form['subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#default_value' => $context['subject'],
    '#maxlength' => '254',
    '#description' => t('The subject of the message.'),
  );
  $form['message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message'),
    '#default_value' => $context['message'],
    '#cols' => '80',
    '#rows' => '20',
    '#description' => t('The message that should be sent. You may include the following variables: %site_name, %patron_name, %patron_email, %node_url, %item_id, %node_type, %title, %barcode, %transaction_name, %notes. Not all variables will be available in all contexts.'),
  );
  return $form;
}