You are here

function jw_player_update_8002 in JW Player 8

Set the jw player key if it already exists.

File

./jw_player.install, line 72
Install, update and uninstall functions for the JW Player module.

Code

function jw_player_update_8002() {

  // The configuration variable license_key has been renamed to jw_player_key.
  $config = \Drupal::configFactory()
    ->getEditable('jw_player.settings');

  // Ensure that the jw_player_key is taken from the license_key when updating
  // if the jw_player_key was not already set.
  if ($config
    ->get('license_key') && !$config
    ->get('jw_player_key')) {
    $config
      ->set('jw_player_key', $config
      ->get('license_key'));
    $config
      ->clear('license_key');
    $config
      ->save();
  }
}