You are here

function filefield_deploy_get_file_fields in Deploy - Content Staging 6

Get an array listing the names of all file fields for a specific content type.

Parameters

$content_type: The content type you want to get file field names from.

Return value

Array of all file fields

2 calls to filefield_deploy_get_file_fields()
filefield_deploy_node_deploy_check in modules/filefield_deploy/filefield_deploy.module
Implementation of hook_node_deploy_check().
filefield_node_deploy in modules/filefield_deploy/filefield_deploy.module
Implementation of hook_node_deploy(),

File

modules/filefield_deploy/filefield_deploy.module, line 100
Deployment API which enables modules to deploy items between servers.

Code

function filefield_deploy_get_file_fields($content_type) {
  static $filefields = array();
  if (empty($filefields[$content_type])) {

    // filefield_get_field_list only exists in filefield 3.x and higher.
    // For lower versions we have to use an alternate method.
    if (function_exists('filefield_get_field_list')) {
      $fields = filefield_get_field_list();
      $fields = array_keys($fields);
    }
    else {
      $info = _content_type_info();
      $fields = $info['content types'][$content_type]['fields'];
      $references = module_invoke_all('file_references', array());
      foreach ($fields as $field) {
        if (array_key_exists($field['module'], $references)) {
          $filefields[$content_type][] = $field['field_name'];
        }
      }
      $fields = $filefields[$content_type];
    }
  }
  return $fields;
}