You are here

function sms_send_form in SMS Framework 5

Same name and namespace in other branches
  1. 6.2 sms.module \sms_send_form()
  2. 6 sms.module \sms_send_form()
  3. 7 sms.module \sms_send_form()

Generates a SMS sending form and adds gateway defined elements. The form array that is returned can be merged with an existing form using array_merge().

Parameters

$required: Specify if the user is required to provide information for the fields.

Return value

$form

3 calls to sms_send_form()
sms_sendtophone_form in modules/sms_sendtophone/sms_sendtophone.module
sms_user_register in modules/sms_user/sms_user.module
sms_user_settings_add_form in modules/sms_user/sms_user.module

File

./sms.module, line 324
The core of the SMS Framework. Provides gateway managment and API for sending and receiving SMS messages.

Code

function sms_send_form($required = FALSE) {
  $gateway = sms_default_gateway();
  $form['number'] = array(
    '#type' => 'textfield',
    '#title' => t('Phone number'),
    '#size' => 40,
    '#maxlength' => 255,
    '#required' => $required,
  );

  // Add gateway defined fields
  if (function_exists($gateway['send form'])) {
    $form['gateway']['#tree'] = TRUE;
    $form['gateway'] = array_merge($gateway['send form']($required), $form['gateway']);
  }
  return $form;
}