install_profile_info($profile, $langcode = 'en')
Retrieves information about an installation profile from its .info.yml file.
The information stored in a profile .info.yml file is similar to that stored in a normal Drupal module .info.yml 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.yml file but not in a normal Drupal module .info.yml file includes:
-
distribution: Existence of this key denotes that the installation profile is intended to be the only eligible choice in a distribution and will be auto-selected during installation, whereas the installation profile selection screen will be skipped. If more than one distribution profile is found then the first one discovered will be selected. The following subproperties may be set:
- name: The name of the distribution that is being installed, to be shown throughout the installation process. If omitted, drupal_install_profile_distribution_name() defaults to 'Drupal'.
-
install: Optional parameters to override the installer:
- theme: The machine name of a theme to use in the installer instead of Drupal's default installer theme.
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.yml 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 1061
- API functions for installing modules and themes.
Code
function install_profile_info($profile, $langcode = 'en') { $cache = &drupal_static(__FUNCTION__, array()); if (!isset($cache[$profile][$langcode])) { // Set defaults for module info. $defaults = array( 'dependencies' => array(), 'themes' => array('stark'), 'description' => '', 'version' => NULL, 'hidden' => FALSE, 'php' => DRUPAL_MINIMUM_PHP, ); $profile_file = drupal_get_path('profile', $profile) . "/$profile.info.yml"; $info = \Drupal::service('info_parser')->parse($profile_file); $info += $defaults; // drupal_required_modules() includes the current profile as a dependency. // Remove that dependency, since a module cannot depend on itself. $required = array_diff(drupal_required_modules(), array($profile)); $locale = !empty($langcode) && $langcode != 'en' ? array('locale') : array(); $info['dependencies'] = array_unique(array_merge($required, $info['dependencies'], $locale)); $cache[$profile][$langcode] = $info; } return $cache[$profile][$langcode]; }
Please login to continue.