You are here

function sms_receive_admin_form in SMS Framework 5

1 string reference to 'sms_receive_admin_form'
sms_receive_menu in modules/sms_receive/sms_receive.module

File

modules/sms_receive/sms_receive.module, line 21

Code

function sms_receive_admin_form() {
  $types = node_get_types();
  $node_types = array();
  foreach ($types as $type) {
    $node_types[$type->type] = $type->name;
  }
  $form['sms_receive_path'] = array(
    '#type' => 'textfield',
    '#title' => t('SMS Receive Path'),
    '#description' => t('Set the path for the callback URL'),
    '#default_value' => variable_get('sms_receive_path', 'sms/in'),
  );
  $form['sms_receive_content_type'] = array(
    '#type' => 'select',
    '#title' => 'Message content type',
    '#default_value' => variable_get('sms_receive_content_type', 'page'),
    '#options' => $node_types,
    '#description' => t('Set the content type that the message is mapped to.'),
  );

  // This should be reworked to be much more configurable... multiple fields assigned either way
  $node_fields = sms_receive_type_fields(variable_get('sms_receive_content_type', 'page'));
  $sms_fields = sms_receive_sms_fields();
  if (!empty($sms_fields)) {
    foreach ($sms_fields as $sms_field) {
      $form['sms_receive_fields']['sms_receive_field_' . $sms_field] = array(
        '#type' => 'select',
        '#title' => t("Map '%field' to this text field", array(
          '%field' => $sms_field,
        )),
        '#default_value' => variable_get('sms_receive_field_' . $sms_field, ''),
        '#options' => $node_fields,
      );
    }
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}