You are here

protected function ThemeStream::getOwnerName in System stream wrapper 8

Gets the module, theme, or profile name of the current URI.

This will return the name of the module, theme or profile e.g.

SystemStream::getOwnerName('module://foo');

and

SystemStream::getOwnerName('module://foo/');

will both return

'foo';

Return value

string The extension name.

Overrides ExtensionStreamBase::getOwnerName

File

src/StreamWrapper/ThemeStream.php, line 20

Class

ThemeStream
Defines the read-only theme:// stream wrapper for theme files.

Namespace

Drupal\system_stream_wrapper\StreamWrapper

Code

protected function getOwnerName() {
  $name = parent::getOwnerName();
  if (!$this
    ->getThemeHandler()
    ->themeExists($name)) {

    // The theme does not exist or is not installed.
    throw new \InvalidArgumentException("Theme {$name} does not exist or is not installed");
  }
  return $name;
}