You are here

public function InstallStorage::getComponentNames in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Config/InstallStorage.php \Drupal\Core\Config\InstallStorage::getComponentNames()

Get all configuration names and folders for a list of modules or themes.

Parameters

\Drupal\Core\Extension\Extension[] $list: An associative array of Extension objects, keyed by extension name.

Return value

array Folders indexed by configuration name.

3 calls to InstallStorage::getComponentNames()
ExtensionInstallStorage::getAllFolders in core/lib/Drupal/Core/Config/ExtensionInstallStorage.php
Returns a map of all config object names and their folders.
InstallStorage::getAllFolders in core/lib/Drupal/Core/Config/InstallStorage.php
Returns a map of all config object names and their folders.
TestInstallStorage::getAllFolders in core/modules/config/tests/config_test/src/TestInstallStorage.php
Returns a map of all config object names and their folders.

File

core/lib/Drupal/Core/Config/InstallStorage.php, line 191
Contains \Drupal\Core\Config\InstallStorage.

Class

InstallStorage
Storage used by the Drupal installer.

Namespace

Drupal\Core\Config

Code

public function getComponentNames(array $list) {
  $extension = '.' . $this
    ->getFileExtension();
  $folders = array();
  foreach ($list as $extension_object) {

    // We don't have to use ExtensionDiscovery here because our list of
    // extensions was already obtained through an ExtensionDiscovery scan.
    $directory = $this
      ->getComponentFolder($extension_object);
    if (is_dir($directory)) {

      // glob() directly calls into libc glob(), which is not aware of PHP
      // stream wrappers. Same for \GlobIterator (which additionally requires
      // an absolute realpath() on Windows).
      // @see https://github.com/mikey179/vfsStream/issues/2
      $files = scandir($directory);
      foreach ($files as $file) {
        if ($file[0] !== '.' && fnmatch('*' . $extension, $file)) {
          $folders[basename($file, $extension)] = $directory;
        }
      }
    }
  }
  return $folders;
}