1 system.install system_update_1022()

Converts theme logo and shortcut settings to site-wide config.

Related topics

File

core/modules/system/system.install, line 2114
Install, update and uninstall functions for the system module.

Code

function system_update_1022() {
  // Update to set the defaults.
  $config = config('system.core');
  $config->set('site_logo_theme', 1);
  $config->set('site_logo_path', '');
  $config->set('site_favicon_theme', 1);
  $config->set('site_favicon_path', 'core/misc/favicon.ico');
  $config->set('site_favicon_mimetype', 'image/vnd.microsoft.icon');

  $settings = update_variable_get('theme_settings');

  // Copy over logo settings.
  if (!empty($settings['toggle_logo'])) {
    $config->set('site_logo_theme', $settings['default_logo']);
    if (is_file($settings['logo_path'])) {
      $config->set('site_favicon_path', $settings['logo_path']);
      $config->set('site_favicon_mimetype', file_get_mimetype($settings['logo_path']));
    }
  }

  // Copy over favicon settings.
  if (!empty($settings['toggle_favicon'])) {
    $config->set('site_favicon_theme', $settings['default_favicon']);
    if (is_file($settings['favicon_path'])) {
      $config->set('site_favicon_path', $settings['favicon_path']);
    }
  }
}