You are here

function lingotek_update_7604 in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.install \lingotek_update_7604()

Erase translation profiles for bundles that no longer exist.

File

./lingotek.install, line 957

Code

function lingotek_update_7604(&$sandbox) {
  $entity_profiles = variable_get('lingotek_entity_profiles');
  foreach ($entity_profiles as $entity_type => $bundles) {
    $entity_bundles = field_info_bundles($entity_type);
    foreach ($bundles as $bundle_name => $profile) {
      if (!array_key_exists($bundle_name, $entity_bundles)) {
        unset($entity_profiles[$entity_type][$bundle_name]);
      }
    }
  }
  variable_set('lingotek_entity_profiles', $entity_profiles);
  return t('Removed Lingotek translation profiles for bundles that not longer exist.');
}