You are here

function filefield_paths_get_fields in File (Field) Paths 5

Same name and namespace in other branches
  1. 6 filefield_paths.module \filefield_paths_get_fields()
2 calls to filefield_paths_get_fields()
filefield_paths_comment in modules/comment_upload.inc
Implementation of hook_comment().
filefield_paths_nodeapi in ./filefield_paths.module
Implementation of hook_nodeapi().

File

./filefield_paths.module, line 391
Adds extra functionality to FileFields Path settings.

Code

function filefield_paths_get_fields($node, $op = NULL) {
  $ffp = array();

  // Invoke hook_filefield_paths_get_fields().
  foreach (module_implements('filefield_paths_get_fields') as $module) {
    $function = $module . '_filefield_paths_get_fields';
    $function($node, $ffp);
  }
  if (count($ffp) == 0 || isset($ffp['#types']) && !is_array($ffp['#types'])) {
    return FALSE;
  }
  $fields = module_invoke_all('filefield_paths_field_settings');

  // Load fields settings
  foreach ($ffp['#types'] as $name => $temp) {
    $result = db_fetch_object(db_query("SELECT * FROM {filefield_paths} WHERE type = '%s' AND field = '%s'", $node->type, $name));
    if (!empty($result)) {
      foreach ($fields as $field) {
        $ffp['#settings'][$name][$field['sql']] = unserialize($result->{$field}['sql']);
      }
    }
  }
  return $ffp;
}