You are here

function realname_registration_settings_form in Realname registration 7

Same name and namespace in other branches
  1. 6.2 realname_registration.admin.inc \realname_registration_settings_form()
  2. 7.2 realname_registration.admin.inc \realname_registration_settings_form()

Form builder;

See also

system_settings_form()

1 string reference to 'realname_registration_settings_form'
realname_registration_menu in ./realname_registration.module
Implementation of hook_menu().

File

./realname_registration.admin.inc, line 14
Admin page callbacks for the realname_registration module.

Code

function realname_registration_settings_form() {
  $form = array();
  $field_req = "\n<ul>\n  <li>" . t('The field name is correct and represents an existing field') . "</li>\n  <li>" . t('The field is associated with the') . ' <em>' . t('user') . "</em> " . t('entity') . "</li>\n  <li>" . t('The field is required and displays on the registration form') . "</li>\n</ul>\n";
  $form['realname_registration_firstname_field'] = array(
    '#type' => 'textfield',
    '#title' => t('First name field'),
    '#default_value' => variable_get('realname_registration_firstname_field'),
    '#description' => t("The name of your first name field. Ensure that:") . $field_req,
  );
  $form['realname_registration_lastname_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Last name field'),
    '#default_value' => variable_get('realname_registration_lastname_field'),
    '#description' => t("The name of your last name field. Ensure that:") . $field_req,
  );
  $form['realname_registration_format'] = array(
    '#type' => 'radios',
    '#title' => t('Username format'),
    '#description' => t('Select the format in which Realname registration will create new usernames.'),
    '#default_value' => variable_get('realname_registration_format', 0),
    '#options' => array(
      t('First name and last name separated by a space (e.g., John Smith)'),
      t('First initial and last name (e.g., JSmith)'),
    ),
    '#required' => TRUE,
  );
  $form['realname_registration_ucfirst'] = array(
    '#type' => 'checkbox',
    '#title' => t('Force the first letters of the first and last names to uppercase'),
    '#default_value' => variable_get('realname_registration_ucfirst', 1),
    '#description' => t("Ensures that the first letter of the users first name and first letter of the users last name are capitalized."),
  );
  $form['realname_registration_tolower'] = array(
    '#type' => 'checkbox',
    '#title' => t('Force lowercase'),
    '#default_value' => variable_get('realname_registration_tolower'),
    '#description' => t("Usernames will be created using only lowercase characters."),
  );
  $form['realname_registration_use_validation'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use Realname registration validation'),
    '#default_value' => variable_get('realname_registration_use_validation', 1),
    '#description' => t("Use regex to validate real names (/^[A-ZÀ-ÖØ-öø-ÿ]+\$/i)"),
  );
  $form['#validate'][] = 'realname_registration_settings_validate';
  return system_settings_form($form);
}