1 install.inc | install_profile_info($profile, $langcode = 'en') |
Retrieves information about an installation profile from its .info file.
The information stored in a profile .info file is similar to that stored in a normal Backdrop module .info file. For example:
- name: The real name of the installation profile for display purposes.
- description: A brief description of the profile.
- dependencies: An array of machine names of other modules that this install profile requires.
Additional, less commonly-used information that can appear in a profile.info file but not in a normal Backdrop module .info file includes:
- distribution_name: The name of the Backdrop distribution that is being installed, to be shown throughout the installation process. Defaults to 'Backdrop CMS'.
- 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 file itself, use system_get_info().
Example of .info file:
name = Minimal
description = Start fresh, with only a few modules enabled.
dependencies[] = block
dependencies[] = dblog
Parameters
$profile: Name of profile.
$langcode: Language code (if any).
Return value
The info array.:
File
- core/
includes/ install.inc, line 1516 - API functions for installing modules and themes.
Code
function install_profile_info($profile, $langcode = 'en') {
$cache = &backdrop_static(__FUNCTION__, array());
if (!isset($cache[$profile])) {
// Set defaults for module info.
$defaults = array(
'dependencies' => array(),
'description' => '',
'distribution_name' => 'Backdrop CMS',
'version' => NULL,
'hidden' => FALSE,
'php' => BACKDROP_MINIMUM_PHP,
);
$info_file = _install_find_profile_file($profile, 'info');
$info = backdrop_parse_info_file($info_file) + $defaults;
$info['dependencies'] = array_unique(array_merge(
backdrop_required_modules(),
$info['dependencies'],
($langcode != 'en' && !empty($langcode) ? array('locale') : array()))
);
// backdrop_required_modules() includes the current profile as a dependency.
// Since a module can't depend on itself we remove that element of the array.
array_shift($info['dependencies']);
$cache[$profile] = $info;
}
return $cache[$profile];
}