function InstallCommand::selectProfile

Same name in other branches
  1. 9 core/lib/Drupal/Core/Command/InstallCommand.php \Drupal\Core\Command\InstallCommand::selectProfile()
  2. 8.9.x core/lib/Drupal/Core/Command/InstallCommand.php \Drupal\Core\Command\InstallCommand::selectProfile()
  3. 10 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

_install_select_profile()

\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 285

Class

InstallCommand
Installs a Drupal site for local testing/development.

Namespace

Drupal\Core\Command

Code

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));
}

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