Problem/Motivation

After updating the module to get support for jw player 7 the license key is missing when was set before.

Proposed resolution

Fix it.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

yongt9412 created an issue. See original summary.

johnchque’s picture

Status: Active » Needs review
StatusFileSize
new643 bytes

Added update function.

berdir’s picture

Status: Needs review » Needs work
+++ b/jw_player.install
@@ -46,3 +46,16 @@ function jw_player_update_8001() {
+  $config = \Drupal::configFactory()->getEditable('jw_player.settings');
+  if ($config->get('license_key')) {
+    if (!$config->get('jw_player_key')) {
+      $config->set('jw_player_key', $config->get('license_key'));
+      $config->clear('license_key');
+    }

this can be a single if condition, that should be a bit easier to read.

Maybe also add a comment that the variable was renamed previously and need to make sure that the new one wasn't already set.

johnchque’s picture

Status: Needs work » Needs review
StatusFileSize
new831 bytes
new929 bytes

That's right! Seems easier to read now! :)

johnchque’s picture

StatusFileSize
new851 bytes
new311 bytes

Save missing right? :)

  • Berdir committed 705ac7a on 8.x-1.x authored by yongt9412
    Issue #2710617 by yongt9412: License key is missing after update
    
berdir’s picture

Status: Needs review » Fixed

Moved the save into the if, we don't need to save if we don't change anything. Committed, thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.