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.
A nested array, keyed first by scheme name ("public" for "public://"), then keyed by the following values:
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_stream_wrappers() {
return array(
'public' => array(
'name' => t('Public files'),
'class' => 'Drupal\\Core\\StreamWrapper\\PublicStream',
'description' => t('Public local files served by the webserver.'),
'type' => STREAM_WRAPPERS_LOCAL_NORMAL,
),
'private' => array(
'name' => t('Private files'),
'class' => 'Drupal\\Core\\StreamWrapper\\PrivateStream',
'description' => t('Private local files served by Drupal.'),
'type' => STREAM_WRAPPERS_LOCAL_NORMAL,
),
'temp' => array(
'name' => t('Temporary files'),
'class' => 'Drupal\\Core\\StreamWrapper\\TemporaryStream',
'description' => t('Temporary local files for upload and previews.'),
'type' => STREAM_WRAPPERS_LOCAL_HIDDEN,
),
'cdn' => array(
'name' => t('Content delivery network files'),
// @todo: Fix the name of this class when we decide on module PSR-0 usage.
'class' => 'MyModuleCDNStream',
'description' => t('Files served by a content delivery network.'),
),
'youtube' => array(
'name' => t('YouTube video'),
// @todo: Fix the name of this class when we decide on module PSR-0 usage.
'class' => 'MyModuleYouTubeStream',
'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,
),
);
}