drupal_get_profile

drupal_get_profile()

Gets the name of the currently active installation profile.

When this function is called during Drupal's initial installation process, the name of the profile that's about to be installed is stored in the global installation state. At all other times, the "install_profile" setting will be available in settings.php.

Return value

string|null $profile The name of the installation profile or NULL if no installation profile is currently active. This is the case for example during the first steps of the installer or during unit tests.

File

core/includes/bootstrap.inc, line 734
Functions that need to be loaded on every Drupal request.

Code

function drupal_get_profile() {
  global $install_state;

  if (drupal_installation_attempted()) {
    // If the profile has been selected return it.
    if (isset($install_state['parameters']['profile'])) {
      $profile = $install_state['parameters']['profile'];
    }
    else {
      $profile = NULL;
    }
  }
  else {
    // Fall back to NULL, if there is no 'install_profile' setting.
    $profile = Settings::get('install_profile');
  }

  return $profile;
}
doc_Drupal
2016-10-29 09:03:14
Comments
Leave a Comment

Please login to continue.