You are here

function filefield_filefield_paths_get_fields in File (Field) Paths 6

Same name and namespace in other branches
  1. 5 modules/filefield.inc \filefield_filefield_paths_get_fields()

Implements hook_filefield_paths_get_fields().

File

modules/filefield.inc, line 45
Provides FileField Paths integration with the FileField module.

Code

function filefield_filefield_paths_get_fields(&$node, &$ffp) {
  if (is_object($node)) {
    $content_type = content_types($node->type);
    foreach ($content_type['fields'] as $field) {
      if ($field['type'] == 'filefield' && isset($node->{$field}['field_name']) && is_array($node->{$field}['field_name'])) {
        foreach ($node->{$field}['field_name'] as &$file) {
          $ffp['#files'][] = array(
            'field' => &$file,
            'module' => $field['module'],
            'name' => $field['field_name'],
            'widget' => $field['widget']['module'],
            'new' => !empty($file['filepath']) && !empty($file['data']['process']) ? TRUE : FALSE,
          );
          if (is_array($file['data']['process'])) {
            unset($file['data']['process']);
          }
          $ffp['#types'][$field['field_name']] = TRUE;
        }
      }
    }
  }
}