You are here

function tmgmt_local_clear_languages_cache in Translation Management Tool 7

Same name and namespace in other branches
  1. 8 translators/tmgmt_local/tmgmt_local.module \tmgmt_local_clear_languages_cache()

Helper function for clearing the languages cache of all local translators.

Can be used in oder to clear the cache for supported target languages after the translation capabilities of an local have changed.

3 calls to tmgmt_local_clear_languages_cache()
tmgmt_local_field_attach_delete in translators/tmgmt_local/tmgmt_local.module
Implements hook_field_attach_delete().
tmgmt_local_field_attach_insert in translators/tmgmt_local/tmgmt_local.module
Implements hook_field_attach_insert().
tmgmt_local_field_attach_update in translators/tmgmt_local/tmgmt_local.module
Implements hook_field_attach_update().

File

translators/tmgmt_local/tmgmt_local.module, line 316
Main module file for the local translation module.

Code

function tmgmt_local_clear_languages_cache() {
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'tmgmt_translator');
  $query
    ->propertyCondition('plugin', 'local');
  $result = $query
    ->execute();
  if ($result) {
    foreach (tmgmt_translator_load_multiple(array_keys($result['tmgmt_translator'])) as $translator) {
      $translator
        ->clearLanguageCache();
    }
  }
}