You are here

protected function LibraryDeriver::getHostExtension in Gin Layout Builder 8.2

Get extension name that hosts the given YAML definition file.

Parameters

string $pathname: YAML definition file full path.

Return value

bool|string Either extension machine name or FALSE if not found.

1 call to LibraryDeriver::getHostExtension()
LibraryDeriver::getPatterns in modules/wingsuit_ui_patterns/src/Plugin/Deriver/LibraryDeriver.php
Get pattern definition objects.

File

modules/wingsuit_ui_patterns/src/Plugin/Deriver/LibraryDeriver.php, line 218

Class

LibraryDeriver
Class LibraryDeriver.

Namespace

Drupal\wingsuit_ui_patterns\Plugin\Deriver

Code

protected function getHostExtension($pathname) {
  $extensions = $this
    ->getExtensionLocations();
  $parts = explode(DIRECTORY_SEPARATOR, $pathname);
  while (!empty($parts)) {
    $path = implode(DIRECTORY_SEPARATOR, $parts);
    if (isset($extensions[$path])) {
      return $extensions[$path];
    }
    array_pop($parts);
  }
  return FALSE;
}