You are here

function sms_simplegateway_admin_form in SMS simple gateway 7

Same name and namespace in other branches
  1. 6 sms_simplegateway.module \sms_simplegateway_admin_form()

Configuration form for gateway module

Parameters

$configuration:

Return value

array Drupal form array

1 string reference to 'sms_simplegateway_admin_form'
sms_simplegateway_gateway_info in ./sms_simplegateway.module
Implements hook_gateway_info().

File

./sms_simplegateway.module, line 45
Simple gateway module for Drupal SMS Framework. Outbound + Inbound

Code

function sms_simplegateway_admin_form($configuration) {
  $form['sms_simplegateway_send'] = array(
    '#type' => 'fieldset',
    '#title' => 'Sender (outgoing messages)',
    '#collapsible' => TRUE,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_method'] = array(
    '#type' => 'radios',
    '#title' => t('HTTP method'),
    '#default_value' => isset($configuration['sms_simplegateway_method']) ? $configuration['sms_simplegateway_method'] : NULL,
    '#options' => array(
      'GET' => 'GET',
      'POST' => 'POST',
    ),
  );
  $form['sms_simplegateway_send']['sms_simplegateway_base_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Base URL for sending messages'),
    '#description' => t('Eg: http://simplegateway.example.com:13031/sendsms'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_base_url']) ? $configuration['sms_simplegateway_base_url'] : NULL,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_user_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Username field name'),
    '#description' => t('Optional. The argument/field name for the field that holds the username. Eg: user, username, authid.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_user_field']) ? $configuration['sms_simplegateway_user_field'] : NULL,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_user_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Username field value'),
    '#description' => t('Optional. Your username for this gateway account.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_user_value']) ? $configuration['sms_simplegateway_user_value'] : NULL,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_pass_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Password field name'),
    '#description' => t('Optional. The argument/field name for the field that holds the password. Eg: pass, password, passwd.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_pass_field']) ? $configuration['sms_simplegateway_pass_field'] : NULL,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_pass_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Password field value'),
    '#description' => t('Optional. Your password for this gateway account.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_pass_value']) ? $configuration['sms_simplegateway_pass_value'] : NULL,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_sender_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Sender (from) field name'),
    '#description' => t('The argument/field name for the field that holds the sender number data. Eg: from, sender'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_sender_field']) ? $configuration['sms_simplegateway_sender_field'] : NULL,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_sender_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Sender (from) field value'),
    '#description' => t('The default value for the sender.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_sender_value']) ? $configuration['sms_simplegateway_sender_value'] : NULL,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_number_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Number (to) field name'),
    '#description' => t('The argument/field name for the field that holds the number data. Eg: number, to, no'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_number_field']) ? $configuration['sms_simplegateway_number_field'] : NULL,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_number_prefix_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Number (to) prefix value'),
    '#description' => t('The value to be prefixed to the sender. Eg: country code'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_number_prefix_value']) ? $configuration['sms_simplegateway_number_prefix_value'] : NULL,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_message_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Message field name'),
    '#description' => t('The argument/field name for the field that holds the message text. Eg: message, text, content'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_message_field']) ? $configuration['sms_simplegateway_message_field'] : NULL,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_extra_params'] = array(
    '#type' => 'textfield',
    '#title' => t('Extra Parameters'),
    '#description' => t('Any additional parameters the gateway may need. Eg: route=1'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_extra_params']) ? $configuration['sms_simplegateway_extra_params'] : NULL,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_authorization'] = array(
    '#type' => 'radios',
    '#title' => t('Authorization'),
    '#description' => t('For POST Requests Only. use "Username field value" & "Password field value" to specify credentials'),
    '#default_value' => isset($configuration['sms_simplegateway_authorization']) ? $configuration['sms_simplegateway_authorization'] : NULL,
    '#options' => array(
      'none' => 'NONE',
      'basic' => 'BASIC',
      'digest' => 'DIGEST',
      'ntlm' => 'NTLM',
    ),
  );
  $form['sms_simplegateway_send']['sms_simplegateway_content_type'] = array(
    '#type' => 'radios',
    '#title' => t('Content Encoding'),
    '#description' => t('For POST Requests Only.'),
    '#default_value' => isset($configuration['sms_simplegateway_content_type']) ? $configuration['sms_simplegateway_content_type'] : NULL,
    '#options' => array(
      'plain' => 'Plain',
      'json' => 'Json',
    ),
  );
  $form['sms_simplegateway_receive'] = array(
    '#type' => 'fieldset',
    '#title' => 'Receiver (incoming messages)',
    '#collapsible' => TRUE,
  );
  $form['sms_simplegateway_receive']['sms_simplegateway_recv_url'] = array(
    '#type' => 'item',
    '#title' => 'Target URL for the message receiver',
    '#markup' => url('sms/simplegateway/receiver', array(
      'absolute' => TRUE,
    )),
  );
  $form['sms_simplegateway_receive']['sms_simplegateway_recv_content_type'] = array(
    '#type' => 'radios',
    '#title' => t('Content Encoding'),
    '#description' => t('For POST Requests Only.'),
    '#default_value' => isset($configuration['sms_simplegateway_recv_content_type']) ? $configuration['sms_simplegateway_recv_content_type'] : NULL,
    '#options' => array(
      'plain' => 'Plain',
      'json' => 'Json',
    ),
  );
  $form['sms_simplegateway_receive']['sms_simplegateway_recv_number_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Sender (from) field name'),
    '#description' => t('The argument/field name for the field that holds the sender number. Eg: sender, from.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_recv_number_field']) ? $configuration['sms_simplegateway_recv_number_field'] : NULL,
  );
  $form['sms_simplegateway_receive']['sms_simplegateway_recv_gwnumber_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Receiver (to) field name'),
    '#description' => t('Optional. The argument/field name for the field that holds the gateway receiver number. Eg: to, inNumber, receiver.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_recv_gwnumber_field']) ? $configuration['sms_simplegateway_recv_gwnumber_field'] : NULL,
  );
  $form['sms_simplegateway_receive']['sms_simplegateway_recv_message_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Message field name'),
    '#description' => t('The argument/field name for the field that holds the message. Eg: message, text, content.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => isset($configuration['sms_simplegateway_recv_message_field']) ? $configuration['sms_simplegateway_recv_message_field'] : NULL,
  );
  return $form;
}