You are here

function filefield_paths_comment in File (Field) Paths 6

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

Implements hook_comment().

1 call to filefield_paths_comment()
comment_upload_filefield_paths_update in modules/comment_upload.inc
Implements hook_filefield_paths_update().

File

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

Code

function filefield_paths_comment($a1, $op) {
  switch ($op) {
    case 'insert':
    case 'update':
      $update = new stdClass();
      $update->node = FALSE;
      $node = node_load($a1['nid']);
      $object = new stdClass();
      $object->form_id = $a1['form_id'];
      $object->type = $node->type;
      $object->files = $a1['files'];
      $object->cid = $a1['cid'];
      if (($ffp = filefield_paths_get_fields($object)) == FALSE) {
        break;
      }

      // Process files
      foreach ($ffp['#files'] as &$file) {
        foreach (module_implements('filefield_paths_process_file') as $module) {
          $function = "{$module}_filefield_paths_process_file";
          $function($file['new'], $file, $ffp['#settings'][$file['name']], $node, $update);
        }
      }
      break;
  }
}