public function i18n_string_object::set_context in Internationalization 7
Set context properties
File
- i18n_string/
i18n_string.inc, line 98 - API for internationalization strings
Class
- i18n_string_object
- String object that contains source and translations.
Code
public function set_context($context) {
$parts = is_array($context) ? $context : explode(':', $context);
$this->context = is_array($context) ? implode(':', $context) : $context;
// Location will be the full string name
$this->location = $this->textgroup . ':' . $this->context;
$this->type = array_shift($parts);
$this->objectid = $parts ? array_shift($parts) : '';
$this->objectkey = (int) $this->objectid;
// Remaining elements glued again with ':'
$this->property = $parts ? implode(':', $parts) : '';
// Attempt to re-build the other data from the persistent cache.
$this
->rebuild_from_cache();
return $this;
}