Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By tim.plunkett on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
The site information settings (as found on http://example.com/admin/config/system/site-information) have been converted to the config system.
For more information on the system as a whole, see http://drupal.org/node/1500260.
D7 and D8 usages are shown on alternating lines to better convey the changes in variable name:
variable_get('site_name', 'Drupal');
Drupal::config('system.site')->get('name');
variable_get('site_mail', '');
Drupal::config('system.site')->get('mail');
variable_get('site_slogan', '');
Drupal::config('system.site')->get('slogan');
variable_get('site_frontpage', 'user');
Drupal::config('system.site')->get('page.front');
variable_get('site_403', '');
Drupal::config('system.site')->get('page.403');
variable_get('site_404', '');
Drupal::config('system.site')->get('page.404');
If you plan on using multiple settings from the same set of configuration, you should store that as a variable first:
$site_config = config('system.site');
$site_config->get('name');
$site_config->get('page.404');
Impacts:
Module developers