You are here

function sms_sendtophone_form in SMS Framework 6

Same name and namespace in other branches
  1. 5 modules/sms_sendtophone/sms_sendtophone.module \sms_sendtophone_form()
  2. 6.2 modules/sms_sendtophone/sms_sendtophone.module \sms_sendtophone_form()
  3. 7 modules/sms_sendtophone/sms_sendtophone.module \sms_sendtophone_form()
1 string reference to 'sms_sendtophone_form'
sms_sendtophone_page in modules/sms_sendtophone/sms_sendtophone.module
Menu callback.

File

modules/sms_sendtophone/sms_sendtophone.module, line 337

Code

function sms_sendtophone_form($form_state, $type) {
  global $user;
  switch ($type) {
    case 'cck':
    case 'inline':
      $form['message'] = array(
        '#type' => 'value',
        '#value' => $_GET['text'],
      );
      $form['message_preview'] = array(
        '#type' => 'item',
        '#value' => '<p class="message-preview">' . check_plain($_GET['text']) . '</p>',
        '#title' => t('Message preview'),
      );
      break;
    case 'node':
      if (is_numeric(arg(3))) {
        $node = node_load(arg(3));
        $form['message'] = array(
          '#type' => 'textarea',
          '#title' => t('Message preview'),
          '#description' => t('This URL will be sent to the phone.'),
          '#cols' => 35,
          '#rows' => 2,
          '#attributes' => array(
            'disabled' => true,
          ),
          '#default_value' => url('node/' . $node->nid, array(
            'absolute' => TRUE,
          )),
        );
      }
      break;
  }
  $form = array_merge(sms_send_form(), $form);
  $form['number']['#default_value'] = $user->sms_user['0']['number'];
  if (is_array($user->sms_user['0']['gateway'])) {
    foreach ($user->sms_user['0']['gateway'] as $option => $value) {
      $form['gateway'][$option]['#default_value'] = $value;
    }
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Send'),
    '#weight' => 20,
  );
  return $form;
}