summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/system/system.api.php31
-rw-r--r--modules/system/system.module4
2 files changed, 29 insertions, 6 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index a5773c300..05c6d4241 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -2297,9 +2297,13 @@ function hook_modules_uninstalled($modules) {
* - 'class' A string specifying the PHP class that implements the
* DrupalStreamWrapperInterface interface.
* - 'description' A string with a short description of what the wrapper does.
- * - 'type' A bitmask of flags indicating what type of streams this wrapper
- * will access - local or remote, readable and/or writeable, etc. Many
- * shortcut constants are defined in stream_wrappers.inc.
+ * - 'type' (Optional) A bitmask of flags indicating what type of streams this
+ * wrapper will access - local or remote, readable and/or writeable, etc.
+ * Many shortcut constants are defined in stream_wrappers.inc. Defaults to
+ * STREAM_WRAPPERS_NORMAL which includes all of these bit flags:
+ * - STREAM_WRAPPERS_READ
+ * - STREAM_WRAPPERS_WRITE
+ * - STREAM_WRAPPERS_VISIBLE
*
* @see file_get_stream_wrappers()
* @see hook_stream_wrappers_alter()
@@ -2311,18 +2315,35 @@ function hook_stream_wrappers() {
'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_HIDDEN,
- )
+ '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,
+ ),
);
}
diff --git a/modules/system/system.module b/modules/system/system.module
index 6de3a8329..d450eadc5 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -1545,12 +1545,13 @@ function system_stream_wrappers() {
'name' => t('Public files'),
'class' => 'DrupalPublicStreamWrapper',
'description' => t('Public local files served by the webserver.'),
+ 'type' => STREAM_WRAPPERS_LOCAL_NORMAL,
),
'temporary' => array(
'name' => t('Temporary files'),
'class' => 'DrupalTemporaryStreamWrapper',
'description' => t('Temporary local files for upload and previews.'),
- 'type' => STREAM_WRAPPERS_HIDDEN,
+ 'type' => STREAM_WRAPPERS_LOCAL_HIDDEN,
),
);
@@ -1560,6 +1561,7 @@ function system_stream_wrappers() {
'name' => t('Private files'),
'class' => 'DrupalPrivateStreamWrapper',
'description' => t('Private local files served by Drupal.'),
+ 'type' => STREAM_WRAPPERS_LOCAL_NORMAL,
);
}