You are here

protected function ModuleStream::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

1 method overrides ModuleStream::getOwnerName()
ProfileStream::getOwnerName in src/StreamWrapper/ProfileStream.php
Gets the module, theme, or profile name of the current URI.

File

src/StreamWrapper/ModuleStream.php, line 20

Class

ModuleStream
Defines the read-only module:// stream wrapper for module files.

Namespace

Drupal\system_stream_wrapper\StreamWrapper

Code

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

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