You are here

function realname_admin_module in Real Name 6

1 string reference to 'realname_admin_module'
realname_menu in ./realname.module
Implements hook_menu().

File

./realname.admin.inc, line 212
The RealName module allows the admin to choose fields from the user profile that will be used to add a "realname" element (method) to a user object. Hook_user is used to automatically add this to any user object that is loaded.

Code

function realname_admin_module($form_state) {
  $form = array();

  // Get the list of modules we support.
  $supported_modules = realname_supported_modules();
  $choices = $show_types = array();
  foreach ($supported_modules as $module => $values) {
    if (module_exists($module)) {
      $choices[$module] = check_plain($values['name']);
      $show_types[$module] = $values['types'];
    }
  }
  $form['show_types'] = array(
    '#type' => 'value',
    '#value' => $show_types,
  );
  if (isset($form_state['storage']['module_chosen'])) {
    $module = $form_state['storage']['module_chosen'];
    $form['module'] = array(
      '#type' => 'item',
      '#value' => t('You have chosen the "@module" module to provide data.', array(
        '@module' => $module,
      )),
    );

    // Now show the types, if appropriate.
    $button_text = t('Use this content type');
    $form['type'] = array(
      '#type' => 'radios',
      '#title' => t('Content types available to @module', array(
        '@module' => $module,
      )),
      '#options' => $form_state['storage']['types'],
      '#default_value' => variable_get('realname_profile_type', NULL),
      '#required' => TRUE,
    );
  }
  else {
    $button_text = t('Use this module');
    $form['module'] = array(
      '#type' => 'radios',
      '#title' => t('These modules are available for providing data to RealName'),
      '#options' => $choices,
      '#default_value' => variable_get('realname_profile_module', NULL),
      '#required' => TRUE,
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => $button_text,
  );
  return $form;
}