function drupal_install_profile_distribution_version

Same name in other branches
  1. 9 core/includes/install.inc \drupal_install_profile_distribution_version()
  2. 8.9.x core/includes/install.inc \drupal_install_profile_distribution_version()
  3. 10 core/includes/install.inc \drupal_install_profile_distribution_version()

Loads the installation profile, extracting its defined version.

Return value

string Distribution version defined in the profile's .info.yml file. Defaults to \Drupal::VERSION if no version is explicitly provided by the installation profile.

See also

install_profile_info()

1 call to drupal_install_profile_distribution_version()
template_preprocess_install_page in core/includes/theme.inc
Prepares variables for install page templates.

File

core/includes/install.inc, line 127

Code

function drupal_install_profile_distribution_version() {
    // During installation, the profile information is stored in the global
    // installation state (it might not be saved anywhere yet).
    if (InstallerKernel::installationAttempted()) {
        global $install_state;
        return $install_state['profile_info']['version'] ?? \Drupal::VERSION;
    }
    else {
        $profile = \Drupal::installProfile();
        $info = \Drupal::service('extension.list.profile')->getExtensionInfo($profile);
        return $info['version'];
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.