function StreamWrapperManager::registerWrapper
Same name in other branches
- 9 core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php \Drupal\Core\StreamWrapper\StreamWrapperManager::registerWrapper()
- 10 core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php \Drupal\Core\StreamWrapper\StreamWrapperManager::registerWrapper()
- 11.x core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php \Drupal\Core\StreamWrapper\StreamWrapperManager::registerWrapper()
Overrides StreamWrapperManagerInterface::registerWrapper
1 call to StreamWrapperManager::registerWrapper()
- StreamWrapperManager::register in core/
lib/ Drupal/ Core/ StreamWrapper/ StreamWrapperManager.php - Registers the tagged stream wrappers.
File
-
core/
lib/ Drupal/ Core/ StreamWrapper/ StreamWrapperManager.php, line 190
Class
- StreamWrapperManager
- Provides a StreamWrapper manager.
Namespace
Drupal\Core\StreamWrapperCode
public function registerWrapper($scheme, $class, $type) {
if (in_array($scheme, stream_get_wrappers(), TRUE)) {
stream_wrapper_unregister($scheme);
}
if (($type & StreamWrapperInterface::LOCAL) == StreamWrapperInterface::LOCAL) {
stream_wrapper_register($scheme, $class);
}
else {
stream_wrapper_register($scheme, $class, STREAM_IS_URL);
}
// Pre-populate the static cache with the filters most typically used.
$info = [
'type' => $type,
'class' => $class,
];
$this->wrappers[StreamWrapperInterface::ALL][$scheme] = $info;
if (($type & StreamWrapperInterface::WRITE_VISIBLE) == StreamWrapperInterface::WRITE_VISIBLE) {
$this->wrappers[StreamWrapperInterface::WRITE_VISIBLE][$scheme] = $info;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.