You are here

function _brazilianids_admin in Brazilian IDs 6

Module settings. Let users should which fields are needed

Return value

Array. The settings form

1 string reference to '_brazilianids_admin'
brazilianids_menu in ./brazilianids.module
Implementation of hook_menu().

File

./brazilianids.module, line 21

Code

function _brazilianids_admin() {

  // Choose which of these fields should be used
  $form = array();
  $form['brazilianids_enable_cpf'] = array(
    '#default_value' => variable_get('brazilianids_enable_cpf', FALSE),
    '#description' => t('Enable the CPF on user profiles.'),
    '#title' => t('Enable the CPF.'),
    '#type' => 'checkbox',
  );
  $form['brazilianids_enable_cnpj'] = array(
    '#default_value' => variable_get('brazilianids_enable_cnpj', FALSE),
    '#description' => t('Enable the CNPJ on user profiles.'),
    '#title' => t('Enable the CNPJ.'),
    '#type' => 'checkbox',
  );
  $form['brazilianids_enable_cpfcnpj'] = array(
    '#default_value' => variable_get('brazilianids_enable_cpfcnpj', FALSE),
    '#description' => t('This option works only when fields CPF and CNPJ are enabled.'),
    '#title' => t('Use the same field for CPF or CNPJ.'),
    '#type' => 'checkbox',
  );
  $form['brazilianids_field_weight'] = array(
    '#type' => 'select',
    '#title' => t('Field weight'),
    '#description' => t('The field weight in the form.'),
    '#default_value' => check_plain(variable_get('brazilianids_field_weight', 0)),
    '#options' => drupal_map_assoc(range(-20, 20)),
  );

  // It will determine if these Brazilian IDs are
  // required fields
  $form['brazilianids_required'] = array(
    '#default_value' => variable_get('brazilianids_required', FALSE),
    '#description' => t('Are these fields required?'),
    '#title' => t('Required'),
    '#type' => 'checkbox',
  );

  // It will determine if these Brazilian IDs should
  // displayed during user registration
  $form['brazilianids_registration'] = array(
    '#default_value' => variable_get('brazilianids_registration', FALSE),
    '#description' => t('Enable the these fields during user registration?'),
    '#title' => t('User registration'),
    '#type' => 'checkbox',
  );
  $form['#submit'][] = 'brazilianids_settings_submit';
  return system_settings_form($form);
}