You are here

function twilio_form_user_register_form_alter in Twilio 7

Implements hook_FORMID_form_alter().

File

./twilio.user.inc, line 99
Twilio user account and registration related functionality

Code

function twilio_form_user_register_form_alter(&$form, &$form_state, $form_id) {
  if ($twilio_registration_form = variable_get('twilio_registration_form', 0)) {
    if ($twilio_registration_form == 2) {
      $required = TRUE;
    }
    else {
      $required = FALSE;
    }
    $form['account']['countrycode'] = array(
      "#type" => 'select',
      '#options' => twilio_country_codes(),
      '#title' => t('Country code'),
    );
    $form['account']['number'] = array(
      '#type' => 'textfield',
      '#title' => t('Phone number'),
      '#required' => $required,
    );
    $form['#validate'][] = 'twilio_register_validate';
    $form['#submit'][] = 'twilio_register_submit';
  }
}