function janrain_capture_settings_fields in Janrain Registration 7
Same name and namespace in other branches
- 7.4 janrain_capture_mapping/janrain_capture_mapping.admin.inc \janrain_capture_settings_fields()
- 7.2 janrain_capture_mapping/janrain_capture_mapping.admin.inc \janrain_capture_settings_fields()
- 7.3 janrain_capture_mapping/janrain_capture_mapping.admin.inc \janrain_capture_settings_fields()
Menu callback: Generate a form to manage Capture profile fields.
See also
_janrain_capture_settings_fields_validate()
_janrain_capture_settings_fields_submit()
1 string reference to 'janrain_capture_settings_fields'
- janrain_capture_mapping_menu in janrain_capture_mapping/
janrain_capture_mapping.module - Implements hook_menu().
File
- janrain_capture_mapping/
janrain_capture_mapping.admin.inc, line 158 - Mapping admin settings functions
Code
function janrain_capture_settings_fields($form, &$form_state) {
$fields = db_query("SELECT fid, title, path FROM {janrain_capture_mapping_field}");
while ($field = $fields
->fetchObject()) {
$admin_field_path = 'admin/config/people/janrain_capture/fields/';
$form[$field->fid] = array(
'title' => array(
'#markup' => $field->title,
),
'path' => array(
'#markup' => $field->path,
),
'edit' => array(
'#type' => 'link',
'#title' => t('edit'),
'#href' => $admin_field_path . 'edit/' . $field->fid,
'#options' => array(
'attributes' => array(
'title' => t('Edit field.'),
),
),
),
'delete' => array(
'#type' => 'link',
'#title' => t('delete'),
'#href' => $admin_field_path . 'delete/' . $field->fid,
'#options' => array(
'attributes' => array(
'title' => t('Delete field.'),
),
),
),
);
}
// Additional row: add new field.
$form['_edit_field'] = array(
'title' => array(
'#type' => 'textfield',
'#title' => t('New field title'),
'#title_display' => 'invisible',
'#size' => 15,
'#attributes' => array(
'class' => array(
'janrain-capture-field-title-input',
),
),
'#description' => t('Title'),
'#prefix' => '<div class="add-new-placeholder">' . t('Add new field') . '</div>',
),
'path' => array(
'#type' => 'textfield',
'#title' => t('New field path'),
'#title_display' => 'invisible',
'#size' => 30,
'#attributes' => array(
'class' => array(
'janrain-capture-path-input',
),
),
'#description' => t('Capture data path'),
'#prefix' => '<div class="add-new-placeholder"> </div>',
),
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save new field'),
);
$form['actions']['reset'] = array(
'#type' => 'link',
'#title' => t('Reset to defaults'),
'#href' => 'admin/config/people/janrain_capture/fields/reset',
);
$form['#tree'] = TRUE;
$form['#validate'][] = '_janrain_capture_settings_fields_validate';
$form['#submit'][] = '_janrain_capture_settings_fields_submit';
return $form;
}