function message_override_message_instance in Message 6
Override the message, and if i18n module is enabled, register the string.
Parameters
$message: The message object passed by reference.
$override_name: The name of the overriden message, to be appended to the original name.
$override_message: The overriden message.
1 call to message_override_message_instance()
- hook_message_instances_alter in ./
message.api.php - Alter the message instances.
File
- ./
message.module, line 687 - API functions to manipulate messages.
Code
function message_override_message_instance(&$message_instance, $override_name, $override_message) {
$message = message_load($message_instance->name);
$message_instance->override_name = $message->name . '_' . $override_name;
$message_instance->message = $override_message;
// Set a flag.
$message_instance->override = TRUE;
if (module_exists('i18nstrings')) {
// Register the string.
$cache = cache_get('message_i18nstrings');
$i18nstrings = array();
if (!empty($cache->data)) {
$i18nstrings = $cache->data;
}
$set = FALSE;
if (empty($i18nstrings[$message_instance->override_name])) {
// Create string.
i18nstrings_update("messages:message:{$message_instance->name}:message", $message_instance->message);
$i18nstrings[$message_instance->override_name] = TRUE;
$set = TRUE;
}
if ($set) {
// Cache all the strings that were translated.
cache_set('message_i18nstrings', $i18nstrings);
}
}
}