You are here

function theme_uif_form_help in User Import Framework 7

Same name and namespace in other branches
  1. 6 uif.admin.inc \theme_uif_form_help()

Theme function for import form help.

1 theme call to theme_uif_form_help()
uif_import_form in ./uif.admin.inc
User import multi-part form.

File

./uif.admin.inc, line 630
Simple, extensible user import from a CSV file.

Code

function theme_uif_form_help() {
  $basic_help = '<p>' . t('Choose an import file. You\'ll have a chance to preview the data before doing the import. The import file must have a header row with a name in each column for the value you are importing. Importable fields include the following:') . '</p>';
  $items = array();

  // Core user table fields
  $supported_fields = uif_get_supported_fields();
  foreach ($supported_fields as $name => $data) {
    if ($data['type'] == 'core') {
      $required = uif_isset_or($data['required']) ? t('required') : t('optional');
      $subs = array(
        '@name' => $name,
        '@required' => $required,
        '!description' => $data['description'],
      );
      $items[] = t('@name (@required) - !description', $subs);
    }
  }

  // Entity fields
  foreach (uif_field_info_instances('user', 'user') as $name => $data) {
    $field_type = uif_lookup_field_type($name);
    if (uif_is_supported_field($field_type)) {
      $subs = array(
        '@name' => $name,
        '@required' => $data['required'] ? t('required') : t('optional'),
        '%label' => $data['label'],
        '%type' => $field_type,
        '@description' => $data['description'] ? $data['description'] : uif_isset_or($supported_fields[$field_type]['description']),
      );
      $items[] = t('@name (@required) - @description (type is %type, human name is %label)', $subs);
    }
  }
  $basic_help .= theme('item_list', array(
    'items' => $items,
  ));
  if (!module_exists('uif_plus')) {
    $basic_help .= '<p>' . t('If you need support for entity reference, file, or image fields, or support for modules such profile2 and organic groups, try adding and enabling the <a href="http://drupal.org/project/uif_plus">User Import Framework Plus</a> module.') . '</p>';
  }

  // Add other modules' help
  $helps = module_invoke_all('uif_help');
  array_unshift($helps, $basic_help);
  $output = '';
  foreach ($helps as $help) {
    $output .= '<div class="uif_help_section">' . $help . '</div>';
  }
  return $output;
}