protected function i18n_string_textgroup_cached::cache_get in Internationalization 7
Get translation from cache.
Extends the original handler with persistent caching.
Parameters
string $context: The context to look out for.
Return value
i18n_string_object|NULL The string object if available or NULL otherwise.
Overrides i18n_string_textgroup_default::cache_get
File
- i18n_string/
i18n_string.inc, line 1459 - API for internationalization strings
Class
- i18n_string_textgroup_cached
- Textgroup handler for i18n_string API which integrated persistent caching.
Code
protected function cache_get($context) {
if (isset($this->strings[$context])) {
// If the cache contains a string re-build i18n_string_object.
if (is_string($this->strings[$context])) {
$i8n_string_object = new i18n_string_object(array(
'textgroup' => $this->textgroup,
));
$i8n_string_object
->set_context($context);
$this->strings[$context] = $i8n_string_object;
}
// Now run the original handling.
return parent::cache_get($context);
}
return NULL;
}