hook_heartbeat_theme_alter

Posted by stalski
<?php
/**
 * Implementation of hook_heartbeat_theme_alter().
 *
 * Take out messages you want to retheme.
 * This can be by adding buttons, html controls, repositioning elements, ...
 * In this example we add buttons and place icons for some message types.
 * In other cases, a custom avatar is used.
 *
 * @param $messages Array of heartbeat activity messages
 * @param $stream HeartbeatAccess as the object that holds the current stream scope
 */
function heartbeat_example_heartbeat_theme_alter(&$messagesHeartbeatAccess $stream) {

  foreach (
$messages as $key => $message) {

    
// This can be usefull to unset the display time for some message types
    
$messages[$key]->display_time FALSE;

    if (
$message->nid 0) {

      
// Example of node load 
      // actor user object is already in the object
      
$node node_load($message->nid);

      
// Catch normal story posts to completely retheme
      
if ($node->type == 'story') {
        
$messages[$key]->message theme('my_custom_theme_function'$message$node);
      }
    }
  }

}
?>