function install_profile_info

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 Drupal 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 shortnames 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 Drupal module .info file includes:

  • 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 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.

6 calls to install_profile_info()
drupal_check_profile in drupal/core/includes/install.inc
Checks an installation profile's requirements.
install_load_profile in drupal/core/includes/install.core.inc
Loads information about the chosen profile during installation.
install_select_profile_form in drupal/core/includes/install.core.inc
Form constructor for the profile selection form.
ModuleApiTest::testDependencyResolution in drupal/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php
Test dependency resolution.
ModuleApiTest::testModuleList in drupal/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php
The basic functionality of module_list().

... See full list

File

drupal/core/includes/install.inc, line 923
API functions for installing modules and themes.

Code

function install_profile_info($profile, $langcode = 'en') {
  $cache =& drupal_static(__FUNCTION__, array());
  if (!isset($cache[$profile])) {

    // Set defaults for module info.
    $defaults = array(
      'dependencies' => array(),
      'description' => '',
      'distribution_name' => 'Drupal',
      'version' => NULL,
      'hidden' => FALSE,
      'php' => DRUPAL_MINIMUM_PHP,
    );
    $profile_file = drupal_get_path('profile', $profile) . "/{$profile}.info";
    $info = drupal_parse_info_file($profile_file);
    $info += $defaults;
    $info['dependencies'] = array_unique(array_merge(drupal_required_modules(), $info['dependencies'], $langcode != 'en' && !empty($langcode) ? array(
      'locale',
    ) : array()));

    // drupal_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];
}