You are here

protected function ModuleExtensionList::getProfileDirectories in Drupal 8

Same name and namespace in other branches
  1. 9 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;
}