You are here

private static function Settings::handleDeprecations in Drupal 10

Same name and namespace in other branches
  1. 9 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()

File

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

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']];
    }
  }
}