function i18n_field_prime_caches in Internationalization 7
Prime the cache to avoid single db queries for entity fields / properties.
This is mainly uses when large operations are occuring like a flush of the entity_property_infos().
2 calls to i18n_field_prime_caches()
- i18n_field_entity_property_callback in i18n_field/
i18n_field.module - Callback to translate entity property info for a fields.
- i18n_field_i18n_object_info_alter in i18n_field/
i18n_field.module - Implements hook_i18n_object_info_alter().
File
- i18n_field/
i18n_field.module, line 476 - Internationalization (i18n) module - Field handling
Code
function i18n_field_prime_caches() {
global $language;
static $cache_primed;
// Fill the cache. This should avoid single db queries when filling the
// properties.
if (empty($cache_primed)) {
$cache_primed = TRUE;
$text_group = i18n_string_textgroup('field');
// Load all strings at once to avoid callbacks for each individual string.
$text_group
->load_strings();
$text_group
->multiple_translation_search(array(
'type' => '*',
'objectid' => '*',
'property' => '*',
), $language->language);
}
}