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:
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:
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
$profile: Name of profile.
$langcode: Language code (if any).
The info array.
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]; }
© 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/core!includes!install.inc/function/install_profile_info/8.1.x