Skip to content

Commit

Permalink
changed: fallback logic for widget setting
Browse files Browse the repository at this point in the history
  • Loading branch information
jeabakker committed Oct 2, 2018
1 parent 683ee33 commit 58490ec
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions lib/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,11 @@ function widget_manager_get_widget_setting($widget_handler, $setting, $context =
return null;
}

$result = false;
// check for old pre Widget Manager 7.0 plugin setting
$plugin_setting = elgg_get_plugin_setting("{$context}_{$widget_handler}_{$setting}", 'widget_manager', null);
if ($plugin_setting !== null) {
if ($plugin_setting == 'yes') {
$result = true;
}
} elseif ($setting == 'can_add') {
$result = true;
if ($setting === 'can_add') {
return true;
}

$widgets_config[$widget_handler]['contexts'][$context][$setting] = (int) $result;
elgg_set_plugin_setting('widgets_config', json_encode($widgets_config), 'widget_manager');

// remove old plugin setting
elgg_unset_plugin_setting("{$context}_{$widget_handler}_{$setting}", 'widget_manager');

return $result;
return false;
}

/**
Expand Down

0 comments on commit 58490ec

Please sign in to comment.