function Settings::handleDeprecations

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::handleDeprecations()
  2. 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 219

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

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