You are here

function heartbeat_gather_messages in Heartbeat 6.3

Same name and namespace in other branches
  1. 6.2 heartbeat.module \heartbeat_gather_messages()

Function that gathers all messages from all modules New ones and existing ones

2 calls to heartbeat_gather_messages()
heartbeat_install in ./heartbeat.install
Implementation of hook_install().
heartbeat_messages_overview in ./heartbeat.admin.inc
Overview list of heartbeat messages This page must be viewed to make the messages appear in the database after a module is installed as well as make them translatable

File

./heartbeat.module, line 600

Code

function heartbeat_gather_messages() {
  $info_default = module_invoke_all('heartbeat_message_info');
  $defaults_lookup = array();
  foreach ($info_default as $default) {
    $defaults_lookup[$default['message_id']] = TRUE;
  }
  $info_cache = heartbeat_messages('all', false, false);

  // dsm($info_default);dsm($info_cache);dsm($info);
  foreach ($info_cache as $key => $cached) {
    if (!isset($defaults_lookup[$cached['message_id']]) && !$cached['custom']) {
      heartbeat_messages_uninstall($cached['message_id'], 'message');
      unset($info_cache[$key]);
    }
  }
  $info = _heartbeat_array_udiff($info_default, $info_cache);
  $info = heartbeat_messages_install($info);
  return $info;
}