You are here

function amazons3_field_default_field_bases_alter in AmazonS3 7

Same name and namespace in other branches
  1. 7.2 amazons3.module \amazons3_field_default_field_bases_alter()

Implements hook_field_default_field_bases_alter().

Allows a variable to override all exported field bases to use 'Amazon S3' as the Upload destination. For example this can be added to environment-specific Drupal settings files, to allow certain environments to upload to S3 while other environments upload to the exported (public or private) URI scheme:

$conf['amazons3_file_uri_scheme_override'] = 's3';

File

./amazons3.module, line 248
Provides S3 stream wrapper

Code

function amazons3_field_default_field_bases_alter(&$fields) {
  if ($uri_scheme = variable_get('amazons3_file_uri_scheme_override', FALSE)) {
    foreach ($fields as $key => $item) {
      if (isset($item['settings']['uri_scheme'])) {
        $fields[$key]['settings']['uri_scheme'] = $uri_scheme;
      }
    }
  }
}