diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 4a37bc2..e566624 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1164,7 +1164,21 @@ function install_select_profile(&$install_state) { } /** - * Selects an installation profile from a list or from a $_POST submission. + * Selects an installation profile. + * + * A profile will be selected if there is only one available profile + * or if a profile was provided in the $_POST submission. + * or if one of the profiles has the exclusive property set to TRUE. + * If more than one profile is set to "exclusive" + * then no profile will be selected. + * + * @param array $profiles + * An associative array of profiles where the keys equal the machine-readable + * names of the profiles. + * + * @return + * Either the machine-readable name of the selected profile + * or no value returned. */ function _install_select_profile($profiles) { // Don't need to choose profile if only one available. @@ -1175,6 +1189,25 @@ function _install_select_profile($profiles) { elseif (!empty($_POST['profile']) && isset($profiles[$_POST['profile']])) { return $profiles[$_POST['profile']]->name; } + else { + // Check for a profile marked "exclusive" and ensure that only one profile + // is marked as such. + $exclusive_profile = NULL; + foreach ($profiles as $profile) { + $profile_info = install_profile_info($profile->name); + if (!empty($profile_info['exclusive'])) { + if (empty($exclusive_profile)) { + $exclusive_profile = $profile->name; + } + else { + // We found a second profile set as "exclusive". + // There's no way to choose between them, so we ignore the property. + return; + } + } + } + return $exclusive_profile; + } } /** diff --git a/core/includes/install.inc b/core/includes/install.inc index efba3c1..714a985 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -887,6 +887,12 @@ function drupal_check_module($module) { * - distribution_name: The name of the Drupal distribution that is being * installed, to be shown throughout the installation process. Defaults to * 'Drupal'. + * - exclusive: If the install profile is intended to be the only eligible + * choice in a distribution, setting exclusive = TRUE will auto-select it + * during installation, and the install profile selection screen will be + * skipped. If more than one profile is found where exclusive = TRUE then + * this property will have no effect and the profile selection screen will + * be shown as normal with all available profiles shown. * * Note that this function does an expensive file system scan to get info file * information for dependencies. If you only need information from the info