You are here

function media_upload_user_files_select in D7 Media 6

Implementation of callback media_upload_media_user_files_select().

TODO: We'll need to investigate performance mechanisms (lazy loading etc.) rather than dumping ALL files in a single go.

Parameters

string $node_type:

string $field:

int $uid:

1 string reference to 'media_upload_user_files_select'
media_upload_media_register in media_upload/media_upload.module
Implementation of hook_media_register

File

media_upload/media_upload.module, line 93
This module provides integration for Drupal's upload module with the Media module

Code

function media_upload_user_files_select($node_type, $field, $uid) {
  $files = array();
  $results = db_query('SELECT filepath, filename FROM {files} WHERE uid = %d', $uid);
  while ($file = db_fetch_array($results)) {
    $files[] = array(
      'uri' => $file['filepath'],
      'filename' => $file['filename'],
      'meta' => '',
    );
  }
  $return = array(
    t('My files') => array(
      t('Local') => media_resource_display_user_files_form($files, t('Your files')),
    ),
  );
  return $return;
}