You are here

function heartbeat_messages_export_messages in Heartbeat 6.3

Same name and namespace in other branches
  1. 6.4 heartbeat.admin.inc \heartbeat_messages_export_messages()

Function to export messages to use as default

1 call to heartbeat_messages_export_messages()
heartbeat_messages_export in ./heartbeat.admin.inc
Function to export messages to use as default

File

./heartbeat.admin.inc, line 505

Code

function heartbeat_messages_export_messages($selected_messages) {
  $messages = heartbeat_messages('all', true, false);
  if (count($messages) == 0) {
    return t('There are not heartbeat messages to export.');
  }
  $info = array();
  foreach ($messages as $message) {
    $message = (object) $message;
    if (!$selected_messages['m_' . $message->hid]) {
      continue;

      // Leave if not selected
    }
    $concat_args = heartbeat_decode_message_variables($message->concat_args);
    $variables = heartbeat_decode_message_variables($message->variables);
    $info[$message->hid] = array(
      'message' => $message->message,
      'message_concat' => $message->message_concat,
      'message_id' => $message->message_id,
      'message_type' => $message->message_type,
      'concat_args' => $concat_args,
      'module' => $message->module,
      'description' => $message->description,
      'variables' => $variables,
    );
  }
  return $info;
}