You are here

function heartbeat_activity_view in Heartbeat 7

heartbeat_activity_view().

Parameters

String $message: The activity message object.

5 calls to heartbeat_activity_view()
HeartbeatStream::render in includes/heartbeatstream.inc
Render().
heartbeat_nodejs_heartbeat_activity_save in modules/heartbeat_nodejs/heartbeat_nodejs.module
Implements hook_heartbeat_activity_save().
template_preprocess_views_view_row_heartbeat in ./heartbeat.views.inc
Template helper for theme_views_view_row_heartbeat.
views_handler_field_heartbeat_attachments::render in views/views_handler_field_heartbeat_attachments.inc
Render the field.
views_plugin_row_heartbeat_view::render in views/views_plugin_row_heartbeat_view.inc
Implements render($row).
1 string reference to 'heartbeat_activity_view'
views_plugin_row_heartbeat_rss::render in views/views_plugin_row_heartbeat_rss.inc
Render a row object. This usually passes through to a theme template of some form, but not always.

File

./heartbeat.module, line 613
Module file for heartbeat activity. Basic hook implementations and helper functions will be found here.

Code

function heartbeat_activity_view($message, $view_mode = NULL) {
  if (isset($view_mode)) {
    $message->view_mode = $view_mode;
  }

  // Remove previously built content, if exists.
  $message->content = array();

  // Build fields content.
  field_attach_prepare_view('heartbeat_activity', array(
    $message->uaid => $message,
  ), $message->view_mode, $message->language);
  entity_prepare_view('heartbeat_activity', array(
    $message->uaid => $message,
  ), $message->language);
  $build = array(
    '#theme' => 'heartbeat_activity',
    '#heartbeat_activity' => $message,
    '#view_mode' => $message->view_mode,
    '#language' => $message->language,
  );
  $build += field_attach_view('heartbeat_activity', $message, $message->view_mode, $message->language);

  // Populate $message->content with a render() array.
  $hook = 'heartbeat_activity_view';
  foreach (module_implements($hook) as $module) {
    $function = $module . '_' . $hook;
    if (function_exists($function)) {
      $result = $function($message, $message->view_mode, $message->language);
    }
  }
  $build += $message->content;

  // We don't need duplicate rendering info in $message->content.
  unset($message->content);

  // Allow modules to modify the structured activity message.
  $type = 'heartbeat_activity';
  drupal_alter(array(
    'heartbeat_activity_view',
    'entity_view',
  ), $build, $type);
  return $build;
}