? bio-fields-on-registration-182266.patch ? bio.module-151572.patch Index: bio.module =================================================================== RCS file: /cvs/drupal/contributions/modules/bio/bio.module,v retrieving revision 1.2.2.12 diff -u -p -r1.2.2.12 bio.module --- bio.module 3 Jul 2007 18:28:09 -0000 1.2.2.12 +++ bio.module 29 Nov 2007 03:00:28 -0000 @@ -195,13 +195,14 @@ function bio_settings() { foreach(node_get_types() as $key => $type) { $types[$key] = $type->name; } + $bio_nodetype = variable_get('bio_nodetype', 'bio'); $form = array(); $form['bio_nodetype'] = array( '#type' => 'select', '#title' => t('Content type for user biographies'), '#description' => t('The content type for user biographies. Each user may create only one node of this type'), '#options' => $types, - '#default_value' => variable_get('bio_nodetype', 'bio'), + '#default_value' => $bio_nodetype, ); $form['bio_link'] = array( '#type' => 'checkboxes', @@ -222,11 +223,49 @@ function bio_settings() { '#description' => t('Display nothing but the bio node on the user profile page.'), '#default_value' => variable_get('bio_profile_takeover', 0), ); + + // Add additional field options. + $type_info = _content_type_info(); + $form['bio_field_options'] = array( + '#type' => 'fieldset', + '#title' => t('Additional field options'), + '#collapsible' => TRUE, + '#theme' => 'bio_field_options', + ); + foreach ($type_info['content types'][$bio_nodetype]['fields'] as $field_name => $properties) { + $form['bio_field_options'][$field_name]['name'] = array( + '#value' => check_plain($field_name), + ); + $form['bio_field_options'][$field_name]["bio_registration_$field_name"] = array( + '#type' => 'checkbox', + '#default_value' => variable_get("bio_registration_$field_name", 0), + ); + } + $add_a_submit = system_settings_form($form); $add_a_submit['#validate']['bio_settings_validate_xxx'] = array(); return $add_a_submit; } +/** + * Format field options from Bio settings form in a table. + * + * @ingroup themeable + */ +function theme_bio_field_options($form) { + $rows = array(); + $header = array(t('Field'), t('Show on registration form')); + + foreach (element_children($form) as $field_name) { + $row = array(); + $row[] = drupal_render($form[$field_name]['name']); + $row[] = drupal_render($form[$field_name]["bio_registration_$field_name"]); + $rows[] = $row; + } + + return theme('table', $header, $rows); +} + /* * A submit handler for the bio settings page so that we can invalidate the views * cache in case the bio node type changed. We need the _xxx suffix to keep it