function message_t in Message 6
Replace arguments with their placeholders.
Parameters
$message: The message instance object.
See also
t().
1 call to message_t()
- message_show_message in ./
message.module - Show a message by the message instance ID.
File
- ./
message.module, line 603 - API functions to manipulate messages.
Code
function message_t($message_instance) {
if (!empty($message_instance->hide)) {
return '';
}
$string = message_get_string_i18n($message_instance);
if (empty($message_instance->arguments)) {
return $string;
}
else {
// Transform arguments before inserting them.
foreach ($message_instance->arguments as $key => $value) {
if (is_array($value) && !empty($value['callback']) && function_exists($value['callback'])) {
// A replacement via callback function.
$value = call_user_func_array($value['callback'], $value['callback arguments']);
}
switch ($key[0]) {
case '@':
// Escaped only.
$args[$key] = check_plain($value);
break;
case '%':
default:
// Escaped and placeholder.
$args[$key] = theme('placeholder', $value);
break;
case '!':
// Pass-through.
$args[$key] = $value;
}
}
return strtr($string, $args);
}
}