function ExtensionStreamBase::getExtensionName
Gets the extension name from the URI.
Return value
string The extension name.
2 calls to ExtensionStreamBase::getExtensionName()
- ExtensionStreamBase::dirname in core/
lib/ Drupal/ Core/ StreamWrapper/ ExtensionStreamBase.php - Gets the name of the directory from a given path.
- ExtensionStreamBase::getDirectoryPath in core/
lib/ Drupal/ Core/ StreamWrapper/ ExtensionStreamBase.php - Gets the path that the wrapper is responsible for.
File
-
core/
lib/ Drupal/ Core/ StreamWrapper/ ExtensionStreamBase.php, line 39
Class
- ExtensionStreamBase
- Defines a base stream wrapper implementation for extension assets.
Namespace
Drupal\Core\StreamWrapperCode
protected function getExtensionName() : string {
$uri_parts = explode('://', $this->uri, 2);
$extension_name = strtok($uri_parts[1], '/');
// Any string that evaluates to empty is considered an invalid extension
// name.
if (empty($extension_name)) {
throw new \RuntimeException("Unable to determine the extension name.");
}
return $extension_name;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.