function InstallStorage::getAllFolders

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

Returns a map of all config object names and their folders.

Return value

array An array mapping config object names with directories.

3 calls to InstallStorage::getAllFolders()
InstallStorage::exists in core/lib/Drupal/Core/Config/InstallStorage.php
Returns whether a configuration object exists.
InstallStorage::getFilePath in core/lib/Drupal/Core/Config/InstallStorage.php
Overrides Drupal\Core\Config\FileStorage::getFilePath().
InstallStorage::listAll in core/lib/Drupal/Core/Config/InstallStorage.php
Gets configuration object names starting with a given prefix.
2 methods override InstallStorage::getAllFolders()
ExtensionInstallStorage::getAllFolders in core/lib/Drupal/Core/Config/ExtensionInstallStorage.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 150

Class

InstallStorage
Storage used by the Drupal installer.

Namespace

Drupal\Core\Config

Code

protected function getAllFolders() {
    if (!isset($this->folders)) {
        $this->folders = [];
        $this->folders += $this->getCoreNames();
        // Perform an ExtensionDiscovery scan as we cannot use
        // \Drupal\Core\Extension\ExtensionList::getPath() yet because the system
        // module may not yet be enabled during install.
        // @todo Remove as part of https://www.drupal.org/node/2186491
        $listing = new ExtensionDiscovery(\Drupal::root());
        if ($profile = \Drupal::installProfile()) {
            $profile_list = $listing->scan('profile');
            if (isset($profile_list[$profile])) {
                // Prime the \Drupal\Core\Extension\ExtensionList::getPathname static
                // cache with the profile info file location so we can use
                // \Drupal\Core\Extension\ExtensionList::getPath() on the active
                // profile during the module scan.
                // @todo Remove as part of https://www.drupal.org/node/2186491
                
                /** @var \Drupal\Core\Extension\ProfileExtensionList $profile_extension_list */
                $profile_extension_list = \Drupal::service('extension.list.profile');
                $profile_extension_list->setPathname($profile, $profile_list[$profile]->getPathname());
                $this->folders += $this->getComponentNames([
                    $profile_list[$profile],
                ]);
            }
        }
        // @todo Remove as part of https://www.drupal.org/node/2186491
        $this->folders += $this->getComponentNames($listing->scan('module'));
        $this->folders += $this->getComponentNames($listing->scan('theme'));
    }
    return $this->folders;
}

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