You are here

function sms_actions_send_action_form in SMS Framework 7

Same name and namespace in other branches
  1. 6.2 modules/sms_actions/sms_actions.module \sms_actions_send_action_form()
  2. 6 modules/sms_actions/sms_actions.module \sms_actions_send_action_form()

Form constructor for sms_actions_send_action form

Parameters

array $context: Array containing contextual information for the action.

Return value

array Drupal form array.

File

modules/sms_actions/sms_actions.module, line 146
Provides a "Send SMS" action and the ability to define custom triggers for incoming messages.

Code

function sms_actions_send_action_form($context) {

  // Set default values for form.
  if (!isset($context['number'])) {
    $context['number'] = '';
  }
  if (!isset($context['author'])) {
    $context['author'] = FALSE;
  }
  if (!isset($context['message'])) {
    $context['message'] = '';
  }
  $form = sms_send_form(NULL, NULL, FALSE);
  $form['number']['#default_value'] = $context['number'];
  $form['author'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send to author of original post'),
    '#description' => t('If checked, the message will be sent to author of the orginal post and the number field will be ignored.'),
    '#default_value' => $context['author'],
  );
  $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, %username, %uid, %node_url, %node_alias, %node_type, %title, %teaser, %body. Not all variables will be available in all contexts.'),
  );
  return $form;
}