You are here

function addthis_update_7402 in AddThis 7.4

Remove old addthis_widget_load_type and transform it into new values.

Transform variable in settings for domready and async. If value = async set domready TRUE and async TRUE. If value = domready set domready TRUE and async FALSE. If value = include set domready FALSE and async FALSE.

File

./addthis.install, line 77
Install, update and uninstall functions for the AddThis module.

Code

function addthis_update_7402() {
  $load_type = variable_get('addthis_widget_load_type', NULL);
  switch ($load_type) {
    case 'async':
      variable_set(AddThis::WIDGET_JS_LOAD_DOMREADY, TRUE);
      variable_set(AddThis::WIDGET_JS_LOAD_ASYNC, TRUE);
      break;
    case 'domready':
      variable_set(AddThis::WIDGET_JS_LOAD_DOMREADY, TRUE);
      variable_set(AddThis::WIDGET_JS_LOAD_ASYNC, FALSE);
      break;
    case 'include':
      variable_set(AddThis::WIDGET_JS_LOAD_DOMREADY, FALSE);
      variable_set(AddThis::WIDGET_JS_LOAD_ASYNC, FALSE);
      break;
    default:
      variable_set(AddThis::WIDGET_JS_LOAD_DOMREADY, TRUE);
      variable_set(AddThis::WIDGET_JS_LOAD_ASYNC, FALSE);
      break;
  }
  variable_del('addthis_widget_load_type');
}