You are here

keycloak.install in Keycloak OpenID Connect 8

Install, uninstall and update hooks of the keycloak module.

File

keycloak.install
View source
<?php

/**
 * @file
 * Install, uninstall and update hooks of the keycloak module.
 */

/**
 * Implements hook_uninstall().
 */
function keycloak_uninstall() {

  // Remove configuration.
  \Drupal::configFactory()
    ->getEditable('openid_connect.settings.keycloak')
    ->delete();
}

/**
 * Update Keycloak plugin settings.
 */
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();
}

Functions

Namesort descending Description
keycloak_uninstall Implements hook_uninstall().
keycloak_update_8101 Update Keycloak plugin settings.