function mailsystem_parse_id in Mail System 6
Same name and namespace in other branches
- 6.2 mailsystem.module \mailsystem_parse_id()
Generates $message['module'] and $message['key'] from $message['id'].
Divides $message['id'] by the '_' character and searches for the longest prefix that corresponds to an enabled module.
Parameters
array &$message: The message array containing at least one element with key 'id'.
Return value
The module portion of $message['id'], if any.
1 call to mailsystem_parse_id()
- mailsystem_mail_alter in ./
mailsystem.module - Formats a message with the appropriate MailSystemInterface class method.
File
- ./
mailsystem.module, line 113 - Provide UI for controlling the mail_system variable.
Code
function mailsystem_parse_id(array &$message) {
if (!isset($message['module'])) {
$key_parts = array();
$module_parts = explode('_', $message['id']);
while ($module_parts && !module_exists(implode('_', $module_parts))) {
array_unshift($key_parts, array_pop($module_parts));
}
$message['key'] = implode('_', $key_parts);
$message['module'] = implode('_', $module_parts);
}
return $message['module'];
}