You are here

function _content_admin_type_fields in Content Construction Kit (CCK) 5

Same name and namespace in other branches
  1. 6 includes/content.admin.inc \_content_admin_type_fields()

Menu callback; lists all defined fields for quick reference.

1 string reference to '_content_admin_type_fields'
content_menu in ./content.module
Implementation of hook_menu().

File

./content_admin.inc, line 11
Administrative interface for content type creation.

Code

function _content_admin_type_fields() {
  $fields = content_fields();
  $header = array(
    t('Field name'),
    t('Field type'),
    t('Used in'),
  );
  $rows = array();
  foreach ($fields as $field) {
    $row = array();
    $row[] = $field['field_name'];
    $row[] = $field['type'];
    $types = array();
    $result = db_query("SELECT nt.name, nt.type FROM {node_field_instance} nfi LEFT JOIN {node_type} nt ON nt.type = nfi.type_name WHERE nfi.field_name = '%s' 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/types/' . $content_type['url_str'] . '/fields');
    }
    $row[] = implode(', ', $types);
    $rows[] = $row;
  }
  $output = theme('table', $header, $rows);
  return $output;
}