function ModuleExtensionList::getProfileDirectories

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/ModuleExtensionList.php \Drupal\Core\Extension\ModuleExtensionList::getProfileDirectories()
  2. 10 core/lib/Drupal/Core/Extension/ModuleExtensionList.php \Drupal\Core\Extension\ModuleExtensionList::getProfileDirectories()
  3. 11.x core/lib/Drupal/Core/Extension/ModuleExtensionList.php \Drupal\Core\Extension\ModuleExtensionList::getProfileDirectories()

Finds all installation profile paths.

Parameters

\Drupal\Core\Extension\ExtensionDiscovery $discovery: The extension discovery.

Return value

string[] Paths to all installation profiles.

1 call to ModuleExtensionList::getProfileDirectories()
ModuleExtensionList::getExtensionDiscovery in core/lib/Drupal/Core/Extension/ModuleExtensionList.php
Returns the extension discovery.

File

core/lib/Drupal/Core/Extension/ModuleExtensionList.php, line 106

Class

ModuleExtensionList
Provides a list of available modules.

Namespace

Drupal\Core\Extension

Code

protected function getProfileDirectories(ExtensionDiscovery $discovery) {
    $discovery->setProfileDirectories([]);
    $all_profiles = $discovery->scan('profile');
    $active_profile = $all_profiles[$this->installProfile];
    $profiles = array_intersect_key($all_profiles, $this->configFactory
        ->get('core.extension')
        ->get('module') ?: [
        $active_profile->getName() => 0,
    ]);
    $profile_directories = array_map(function (Extension $profile) {
        return $profile->getPath();
    }, $profiles);
    return $profile_directories;
}

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