function content_fields_list in Content Construction Kit (CCK) 6.2
Same name and namespace in other branches
- 6.3 includes/content.admin.inc \content_fields_list()
Menu callback; lists all defined fields for quick reference.
1 string reference to 'content_fields_list'
- content_menu in ./
content.module - Implementation of hook_menu().
File
- includes/
content.admin.inc, line 65 - Administrative interface for content type creation.
Code
function content_fields_list() {
$fields = content_fields();
$field_types = _content_field_types();
// Sort fields by field name.
ksort($fields);
$header = array(
t('Field name'),
t('Field type'),
t('Used in'),
);
$rows = array();
foreach ($fields as $field) {
$row = array();
$row[] = $field['locked'] ? t('@field_name (Locked)', array(
'@field_name' => $field['field_name'],
)) : $field['field_name'];
$row[] = t($field_types[$field['type']]['label']);
$types = array();
$result = db_query("SELECT nt.name, nt.type FROM {" . content_instance_tablename() . "} nfi " . "LEFT JOIN {node_type} nt ON nt.type = nfi.type_name " . "WHERE nfi.field_name = '%s' " . "AND nfi.widget_active = 1 " . "ORDER BY nt.name ASC", $field['field_name']);
while ($type = db_fetch_array($result)) {
$content_type = content_types($type['type']);
$types[] = l($type['name'], 'admin/content/node-type/' . $content_type['url_str'] . '/fields');
}
$row[] = implode(', ', $types);
$rows[] = array(
'data' => $row,
'class' => $field['locked'] ? 'menu-disabled' : '',
);
}
if (empty($rows)) {
$output = t('No fields have been defined for any content type yet.');
}
else {
$output = theme('table', $header, $rows);
}
return $output;
}