You are here

function comment_upload_filefield_paths_get_fields in File (Field) Paths 5

Same name and namespace in other branches
  1. 6 modules/comment_upload.inc \comment_upload_filefield_paths_get_fields()

Implementation of hook_filefield_paths_get_fields().

File

modules/comment_upload.inc, line 51
Provides FileField Paths integration with the Comment Upload module.

Code

function comment_upload_filefield_paths_get_fields(&$node, &$ffp) {
  if (is_object($node) && isset($node->cid) && isset($node->files)) {
    foreach ($node->files as &$file) {
      $new = FALSE;
      if (preg_match('/upload_([\\d])/', $file['fid'], $match)) {
        $new = TRUE;
        $file = (array) $node->processed_files[$match[1]];
      }
      $ffp['#files'][] = array(
        'field' => &$file,
        'module' => 'comment_upload',
        'name' => 'comment_upload',
        'new' => $new,
      );
      $ffp['#types']['comment_upload'] = TRUE;
    }
  }
}