function _install_select_profile
_install_select_profile($profiles)
Selects an installation profile.
A profile will be selected if:
- Only one profile is available,
- A profile was submitted through $_POST,
- Exactly one of the profiles is marked as "exclusive".
If multiple profiles are marked as "exclusive" then no profile will be selected.
Parameters
array $profiles: 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
- includes/install.core.inc, line 1096
- API functions for installing Drupal.
Code
function _install_select_profile($profiles) { if (sizeof($profiles) == 0) { throw new Exception(install_no_profile_error()); } // Don't need to choose profile if only one available. if (sizeof($profiles) == 1) { $profile = array_pop($profiles); // TODO: is this right? require_once DRUPAL_ROOT . '/' . $profile->uri; return $profile->name; } else { foreach ($profiles as $profile) { if (!empty($_POST['profile']) && ($_POST['profile'] == $profile->name)) { return $profile->name; } } } // Check for a profile marked as "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 "exclusive" profile. There's no way to choose // between them, so we ignore the property. return; } } } return $exclusive_profile; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!install.core.inc/function/_install_select_profile/7.x