function profile_realname_get_fields in Real Name 6
File
- ./
realname_profile.inc, line 20 - Realname module support for Profile (core) module.
Code
function profile_realname_get_fields($current) {
$fields = $links = array();
$result = db_query("SELECT name, type, title FROM {profile_fields}");
while ($field = db_fetch_array($result)) {
switch ($field['type']) {
case 'selection':
case 'textfield':
$name = $field['name'];
$selected = array_key_exists($name, (array) $current);
$fields[$name] = array(
'title' => $field['title'],
'weight' => $selected ? $current[$name] : 0,
'selected' => $selected,
);
break;
case 'url':
$links[$field['name']] = $field['title'];
break;
default:
break;
}
}
return array(
'fields' => $fields,
'links' => $links,
);
}