You are here

function s3fs_cors_element_info in S3 File System CORS Upload 7

Implements hook_element_info().

File

./s3fs_cors.module, line 62
Allow uploading of files directly to AmazonS3 via the browser using CORS.

Code

function s3fs_cors_element_info() {
  $config = _s3fs_get_config();
  $file_path = drupal_get_path('module', 's3fs_cors');
  $types['s3fs_cors_upload'] = array(
    '#input' => TRUE,
    '#process' => array(
      's3fs_cors_upload_process',
    ),
    '#value_callback' => 's3fs_cors_upload_value',
    '#element_validate' => array(
      's3fs_cors_upload_validate',
    ),
    '#pre_render' => array(
      'file_managed_file_pre_render',
    ),
    '#theme' => 's3fs_cors_upload',
    '#theme_wrappers' => array(
      'form_element',
    ),
    '#upload_validators' => array(),
    // The default directory for uploaded files. This will be overidden later,
    // but we must set it here to satisfy an internal Drupalism.
    '#upload_location' => 's3://',
    '#size' => 22,
    '#extended' => FALSE,
    '#attached' => array(
      'js' => array(
        $file_path . '/s3fs_cors.js',
        // The File module's JS does things like client side validation for us.
        drupal_get_path('module', 'file') . '/file.js',
      ),
      'library' => array(
        array(
          'system',
          'ui.progressbar',
        ),
      ),
    ),
  );
  return $types;
}