function site_settings_update_8001 in Site Settings and Labels 8
Set the default template key if upgrading.
File
- ./
site_settings.install, line 51 - Contains install and update hooks.
Code
function site_settings_update_8001() {
// On initial install set template_key to site_settings.
$config = \Drupal::configFactory()
->getEditable('site_settings.config');
$template_key = $config
->get('template_key');
if (!$template_key) {
// If we don't have a template key, we are updating, maintain existing
// template key of 'settings' to avoid breaking update path. New installs
// will have template_key set in hook_install.
$config
->set('template_key', 'settings');
$config
->save();
}
}