You are here

function webform_localization_uuid_update_strings in Webform Localization 7.4

Same name and namespace in other branches
  1. 7 includes/webform_localization.i18n.inc \webform_localization_uuid_update_strings()

Update i18n string contexts if uuid module is enabled/disabled.

3 calls to webform_localization_uuid_update_strings()
webform_localization_i18n_string_refresh in ./webform_localization.module
Update / create / delete translation source for components.
webform_localization_modules_disabled in ./webform_localization.module
Implements hook_modules_disabled().
webform_localization_modules_enabled in ./webform_localization.module
Implements hook_modules_enabled().

File

includes/webform_localization.i18n.inc, line 522
Webform Localization i18n_string integration.

Code

function webform_localization_uuid_update_strings($disabling_uuid = FALSE) {
  module_load_install('i18n_string');
  $old_ids = db_query('SELECT distinct type FROM {i18n_string} WHERE textgroup = :webform', array(
    ':webform' => 'webform',
  ))
    ->fetchCol();
  variable_set('webform_localization_using_uuid', !$disabling_uuid);
  if (empty($old_ids)) {
    return;
  }
  if (!$disabling_uuid) {
    $old_context_ids = entity_get_uuid_by_id('node', array(
      $old_ids,
    ));
  }
  else {

    // entity_get_id_by_uuid() do not work properly on hook_disable.
    $old_context_ids = webform_localization_get_id_by_uuid('node', array(
      $old_ids,
    ));
  }
  foreach ($old_context_ids as $old_id => $new_id) {
    $old_context = 'webform:' . $old_id . ':*';
    $new_context = 'webform:' . $new_id . ':*';
    i18n_string_install_update_context($old_context, $new_context);
  }
}