You are here

function filefield_get_field_list in FileField 6.3

Return an array of file fields within a node type or by field name.

Parameters

$field: Optional. May be either a field array or a field name.

$node_type: Optional. The node type to filter the list of fields.

4 calls to filefield_get_field_list()
filefield_delete_file_references in ./filefield.module
Delete all node references of a file.
filefield_get_file_references in ./filefield.module
Get a list of node IDs that reference a file.
filefield_get_file_reference_count in ./filefield.module
Count the number of times the file is referenced within a field.
filefield_get_node_files in ./filefield.module
Get all FileField files connected to a node ID.

File

./filefield.module, line 976
FileField: Defines a CCK file field type.

Code

function filefield_get_field_list($node_type = NULL, $field = NULL) {

  // Build the list of fields to be used for retrieval.
  if (isset($field)) {
    if (is_string($field)) {
      $field = content_fields($field, $node_type);
    }
    $fields = array(
      $field['field_name'] => $field,
    );
  }
  elseif (isset($node_type)) {
    $type = content_types($node_type);
    $fields = $type['fields'];
  }
  else {
    $fields = content_fields();
  }

  // Filter down the list just to file fields.
  foreach ($fields as $key => $field) {
    if ($field['type'] != 'filefield') {
      unset($fields[$key]);
    }
  }
  return $fields;
}