You are here

private static function Settings::handleDeprecations in Drupal 9

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::handleDeprecations()

Handle deprecated values in the site settings.

Parameters

array $settings: The site settings.

See also

self::getDeprecatedSettings()

1 call to Settings::handleDeprecations()
Settings::initialize in core/lib/Drupal/Core/Site/Settings.php
Bootstraps settings.php and the Settings singleton.

File

core/lib/Drupal/Core/Site/Settings.php, line 243

Class

Settings
Read only settings that are initialized with the class.

Namespace

Drupal\Core\Site

Code

private static function handleDeprecations(array &$settings) : void {
  foreach (self::$deprecatedSettings as $legacy => $deprecation) {
    if (!empty($settings[$legacy])) {
      @trigger_error($deprecation['message'], E_USER_DEPRECATED);

      // Set the new key if needed.
      if (!isset($settings[$deprecation['replacement']])) {
        $settings[$deprecation['replacement']] = $settings[$legacy];
      }
    }

    // Ensure that both keys have the same value.
    if (isset($settings[$deprecation['replacement']])) {
      $settings[$legacy] = $settings[$deprecation['replacement']];
    }
  }
}