You are here

function heartbeat_messages_revert in Heartbeat 6.4

Revert a heartbeat message back to default

2 calls to heartbeat_messages_revert()
heartbeat_features_revert in ./heartbeat.features.inc
Implementation of hook_features_revert().
heartbeat_revert_confirm_submit in ./heartbeat.admin.inc
Handler for revert confirmation

File

./heartbeat.admin.inc, line 1323
Admnistration tasks for heartbeat.

Code

function heartbeat_messages_revert($hid) {

  // Delete the old message
  $old_message = heartbeat_message_load($hid);
  $result = heartbeat_messages_uninstall($old_message->message_id, 'message');

  // Insert the default back in
  $defaults = module_invoke_all('heartbeat_message_info');
  foreach ($defaults as $key => $message) {
    $message = (object) $message;
    if ($message->message_id == $old_message->message_id) {
      heartbeat_messages_install(array(
        $message,
      ));
    }
  }
}