You are here

function content_fields in Content Construction Kit (CCK) 5

Same name and namespace in other branches
  1. 6.3 content.module \content_fields()
  2. 6 content.module \content_fields()
  3. 6.2 content.module \content_fields()

Return a list of all fields.

Parameters

$field_name: If set, return information on just this field.

$content_type_name: If set, return information of the field within the context of this content type.

31 calls to content_fields()
content_copy_export_form in ./content_copy.module
A form to export field definitions.
content_format in ./content.module
Format a field item for display.
content_panels_edit_field in ./content_panels.inc
content_panels_title_content in ./content_panels.inc
'Title' callback for the 'field' content type.
content_pathauto_node in ./content_pathauto.inc

... See full list

File

./content.module, line 712
Allows administrators to associate custom fields to content types.

Code

function content_fields($field_name = NULL, $content_type_name = NULL) {
  $info = _content_type_info();

  // If there is no field name specified, return the entire fields array.
  if (!isset($field_name)) {
    return $info['fields'];
  }
  elseif (!isset($info['fields'][$field_name])) {
    return NULL;
  }
  elseif (!isset($content_type_name)) {
    return $info['fields'][$field_name];
  }
  elseif (isset($info['content types'][$content_type_name]['fields'][$field_name])) {
    return $info['content types'][$content_type_name]['fields'][$field_name];
  }

  // If all else fails, return NULL.
  return NULL;
}