function InstallStorage::getCoreNames

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/InstallStorage.php \Drupal\Core\Config\InstallStorage::getCoreNames()
  2. 10 core/lib/Drupal/Core/Config/InstallStorage.php \Drupal\Core\Config\InstallStorage::getCoreNames()
  3. 11.x core/lib/Drupal/Core/Config/InstallStorage.php \Drupal\Core\Config\InstallStorage::getCoreNames()

Get all configuration names and folders for Drupal core.

Return value

array Folders indexed by configuration name.

3 calls to InstallStorage::getCoreNames()
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 216

Class

InstallStorage
Storage used by the Drupal installer.

Namespace

Drupal\Core\Config

Code

public function getCoreNames() {
    $extension = '.' . $this->getFileExtension();
    $pattern = '/' . preg_quote($extension, '/') . '$/';
    $folders = [];
    $directory = $this->getCoreFolder();
    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] !== '.' && preg_match($pattern, $file)) {
                $folders[basename($file, $extension)] = $directory;
            }
        }
    }
    return $folders;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.