You are here

function content_fields in Content Construction Kit (CCK) 6.2

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

Return a list of all fields.

Parameters

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

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

Be sure to check empty() instead of isset() on field_name and content_type_name to avoid bad results when the value is set but empty, as sometimes happens in the formatter.

59 calls to content_fields()
content_add_more_js in includes/content.node_form.inc
Menu callback for AHAH addition of new empty widgets.
content_content_field_content_type_admin_title in includes/panels/content_types/content_field.inc
Admin title for field content type.
content_content_field_content_type_edit_form in includes/panels/content_types/content_field.inc
Returns a settings form for the custom type.
content_content_field_content_type_render in includes/panels/content_types/content_field.inc
Output function for the 'field' content type.
content_copy_export_form in modules/content_copy/content_copy.module
A form to export field definitions.

... See full list

File

./content.module, line 1341
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 (isset($info['fields'])) {
    if (empty($field_name)) {
      return $info['fields'];
    }
    if (isset($info['fields'][$field_name])) {
      if (empty($content_type_name)) {
        return $info['fields'][$field_name];
      }
      if (isset($info['content types'][$content_type_name]['fields'][$field_name])) {
        return $info['content types'][$content_type_name]['fields'][$field_name];
      }
    }
  }
}