function hook_stream_wrappers

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 system.api.php hook_stream_wrappers()
cle7 system.api.php hook_stream_wrappers()
elmsmedia7 system.api.php hook_stream_wrappers()
icor7 system.api.php hook_stream_wrappers()
meedjum_blog7 system.api.php hook_stream_wrappers()
mooc7 system.api.php hook_stream_wrappers()

Registers PHP stream wrapper implementations associated with a module.

Provide a facility for managing and querying user-defined stream wrappers in PHP. PHP's internal stream_get_wrappers() doesn't return the class registered to handle a stream, which we need to be able to find the handler for class instantiation.

If a module registers a scheme that is already registered with PHP, it will be unregistered and replaced with the specified class.

Return value

A nested array, keyed first by scheme name ("public" for "public://"), then keyed by the following values:

See also

file_get_stream_wrappers()

hook_stream_wrappers_alter()

system_stream_wrappers()

Related topics

6 functions implement hook_stream_wrappers()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

file_entity_get_hidden_stream_wrappers in sites/all/modules/ulmus/file_entity/file_entity.module
Helper function to get a list of hidden stream wrappers.
file_get_stream_wrappers in includes/file.inc
Provides Drupal stream wrapper registry.
file_test_stream_wrappers in modules/simpletest/tests/file_test.module
Implements hook_stream_wrappers().
media_get_local_stream_wrappers in sites/all/modules/ulmus/media/media.module
Helper function to get a list of local stream wrappers.
media_get_remote_stream_wrappers in sites/all/modules/ulmus/media/media.module
Helper function to get a list of remote stream wrappers.

... See full list

1 invocation of hook_stream_wrappers()
file_get_stream_wrappers in includes/file.inc
Provides Drupal stream wrapper registry.

File

modules/system/system.api.php, line 2691
Hooks provided by Drupal core and the System module.

Code

function hook_stream_wrappers() {
  return array(
    'public' => array(
      'name' => t('Public files'),
      'class' => 'DrupalPublicStreamWrapper',
      'description' => t('Public local files served by the webserver.'),
      'type' => STREAM_WRAPPERS_LOCAL_NORMAL,
    ),
    'private' => array(
      'name' => t('Private files'),
      'class' => 'DrupalPrivateStreamWrapper',
      'description' => t('Private local files served by Drupal.'),
      'type' => STREAM_WRAPPERS_LOCAL_NORMAL,
    ),
    'temp' => array(
      'name' => t('Temporary files'),
      'class' => 'DrupalTempStreamWrapper',
      'description' => t('Temporary local files for upload and previews.'),
      'type' => STREAM_WRAPPERS_LOCAL_HIDDEN,
    ),
    'cdn' => array(
      'name' => t('Content delivery network files'),
      'class' => 'MyModuleCDNStreamWrapper',
      'description' => t('Files served by a content delivery network.'),
      // 'type' can be omitted to use the default of STREAM_WRAPPERS_NORMAL
    ),
    'youtube' => array(
      'name' => t('YouTube video'),
      'class' => 'MyModuleYouTubeStreamWrapper',
      'description' => t('Video streamed from YouTube.'),
      
      // A module implementing YouTube integration may decide to support using
      // the YouTube API for uploading video, but here, we assume that this
      // particular module only supports playing YouTube video.
      'type' => STREAM_WRAPPERS_READ_VISIBLE,
    ),
  );
}