You are here

protected function LibraryStream::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 call to LibraryStream::getOwnerName()
LibraryStream::getDirectoryPath in src/StreamWrapper/LibraryStream.php
Gets the path that the wrapper is responsible for.

File

src/StreamWrapper/LibraryStream.php, line 22

Class

LibraryStream
Defines the read-only library:// stream wrapper for library files.

Namespace

Drupal\system_stream_wrapper\StreamWrapper

Code

protected function getOwnerName() {
  $name = parent::getOwnerName();
  $library_discovery = new LibraryDiscovery($this
    ->getDrupalRoot());
  $files = $library_discovery
    ->scan(LibraryDiscovery::EXTENSION_TYPE);
  if (!isset($files[$name])) {
    throw new \InvalidArgumentException("Library {$name} does not exist");
  }
  return $name;
}