_install_select_profile(&$install_state)
Determines the installation profile to use in the installer.
A profile will be selected in the following order of conditions:
- Only one profile is available.
- A specific profile name is requested in installation parameters:
- For interactive installations via request query parameters.
- For non-interactive installations via install_drupal() settings.
- A discovered profile that is a distribution. If multiple profiles are distributions, then the first discovered profile will be selected.
- Only one visible profile is available.
Parameters
array $install_state: The current installer state, containing a 'profiles' key, which is an associative array of profiles with the machine-readable names as keys.
Return value
The machine-readable name of the selected profile or NULL if no profile was selected.
File
- core/includes/install.core.inc, line 1206
- API functions for installing Drupal.
Code
function _install_select_profile(&$install_state) { // Don't need to choose profile if only one available. if (count($install_state['profiles']) == 1) { return key($install_state['profiles']); } if (!empty($install_state['parameters']['profile'])) { $profile = $install_state['parameters']['profile']; if (isset($install_state['profiles'][$profile])) { return $profile; } } // Check for a distribution profile. foreach ($install_state['profiles'] as $profile) { $profile_info = install_profile_info($profile->getName()); if (!empty($profile_info['distribution'])) { return $profile->getName(); } } // Get all visible (not hidden) profiles. $visible_profiles = array_filter($install_state['profiles'], function($profile) { $profile_info = install_profile_info($profile->getName()); return !isset($profile_info['hidden']) || !$profile_info['hidden']; }); if (count($visible_profiles) == 1) { return (key($visible_profiles)); } }
Please login to continue.