You are here

function keycloak_update_8101 in Keycloak OpenID Connect 8

Update Keycloak plugin settings.

File

./keycloak.install, line 19
Install, uninstall and update hooks of the keycloak module.

Code

function keycloak_update_8101() {
  $settings = \Drupal::configFactory()
    ->getEditable('openid_connect.settings.keycloak');
  $enabled = $settings
    ->get('settings.keycloak_i18n');
  $mapping = $settings
    ->get('settings.keycloak_i18n_mapping');
  $settings
    ->set('settings.keycloak_i18n.enabled', !empty($enabled));
  $settings
    ->set('settings.keycloak_i18n.mapping', !empty($mapping) ? $mapping : []);
  $settings
    ->clear('settings.redirect_url');
  $settings
    ->clear('settings.authorization_endpoint_kc');
  $settings
    ->clear('settings.token_endpoint_kc');
  $settings
    ->clear('settings.userinfo_endpoint_kc');
  $settings
    ->save();
}