protected function InstallCommand::selectProfile in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Command/InstallCommand.php \Drupal\Core\Command\InstallCommand::selectProfile()
Selects the install profile to use.
Parameters
\Symfony\Component\Console\Style\SymfonyStyle $io: Symfony style output decorator.
Return value
string The selected install profile.
See also
\Drupal\Core\Installer\Form\SelectProfileForm
1 call to InstallCommand::selectProfile()
- InstallCommand::execute in core/lib/ Drupal/ Core/ Command/ InstallCommand.php 
File
- core/lib/ Drupal/ Core/ Command/ InstallCommand.php, line 246 
Class
- InstallCommand
- Installs a Drupal site for local testing/development.
Namespace
Drupal\Core\CommandCode
protected function selectProfile(SymfonyStyle $io) {
  $profiles = $this
    ->getProfiles();
  // If there is a distribution there will be only one profile.
  if (count($profiles) == 1) {
    return key($profiles);
  }
  // Display alphabetically by human-readable name, but always put the core
  // profiles first (if they are present in the filesystem).
  natcasesort($profiles);
  if (isset($profiles['minimal'])) {
    // If the expert ("Minimal") core profile is present, put it in front of
    // any non-core profiles rather than including it with them
    // alphabetically, since the other profiles might be intended to group
    // together in a particular way.
    $profiles = [
      'minimal' => $profiles['minimal'],
    ] + $profiles;
  }
  if (isset($profiles['standard'])) {
    // If the default ("Standard") core profile is present, put it at the very
    // top of the list. This profile will have its radio button pre-selected,
    // so we want it to always appear at the top.
    $profiles = [
      'standard' => $profiles['standard'],
    ] + $profiles;
  }
  reset($profiles);
  return $io
    ->choice('Select an installation profile', $profiles, current($profiles));
}