You are here

function redhen_fields_email_action_form in RedHen CRM 7

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

Parameters

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

Return value

array Form definition.

See also

redhen_fields_email_action_submit()

File

modules/redhen_fields/redhen_fields.module, line 770
Defines email, phone and address field types for RedHen CRM.

Code

function redhen_fields_email_action_form($context) {

  // Set default values for form.
  if (!isset($context['subject'])) {
    $context['subject'] = '';
  }
  if (!isset($context['message'])) {
    $context['message'] = '';
  }
  if ($context['entity_type'] == 'redhen_contact') {
    $msg = t('This message will be sent to the configured email field for each selected contact.');
  }
  else {
    $msg = t('This message will be sent to the default email address of the primary contact for each selected organization.');
  }
  $form['info'] = array(
    '#type' => 'item',
    '#markup' => $msg,
  );
  $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 placeholders like [node:title], [user:name], and [comment:body] to represent data that will be different each time message is sent. Not all placeholders will be available in all contexts.'),
  );
  return $form;
}