You are here

function hook_heartbeat_activity_view in Heartbeat 7

This hook is provided by Heartbeat to prepare content for an activity object.

In fact the result needs to be a well formed drupal build to alter in any way. It will be mostly used to add output of fields retrieved by a theme function. This hook will be used to load build elements or already parsed output.

Underneath is the example of heartbeat's own implementation of this hook.

Parameters

HeartbeatActivity $heartbeatActivity: The activity message activity object.

String $view_mode: The view mode of the activity object.

string $language: The language of the activity message.

2 functions implement hook_heartbeat_activity_view()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

heartbeat_heartbeat_activity_view in ./heartbeat.module
Implements hook_heartbeat_activity_view().
heartbeat_plugins_heartbeat_activity_view in modules/heartbeat_plugins/heartbeat_plugins.module
Implements hook_heartbeat_activity_view().

File

./heartbeat.api.php, line 260
Hooks provided by the Heartbeat API.

Code

function hook_heartbeat_activity_view(HeartbeatActivity $heartbeatActivity, $view_mode = 'full', $language = NULL) {
  if (isset($heartbeatActivity->actor->picture->uri)) {
    $heartbeatActivity->content['avatar'] = array(
      '#markup' => theme('image_style', array(
        'style_name' => 'thumbnail',
        'path' => $heartbeatActivity->actor->picture->uri,
        'attributes' => array(
          'class' => 'avatar',
        ),
      )),
    );
  }
  $heartbeatActivity->content['message'] = array(
    '#attributes' => array(
      'class' => array(
        'activity-message',
      ),
    ),
    '#title' => t('Heartbeat activity message'),
    '#markup' => $heartbeatActivity->message,
  );
  $heartbeatActivity->content['time'] = array(
    '#title' => t('Activity on'),
    '#markup' => theme('heartbeat_time_ago', array(
      'heartbeat_activity' => $heartbeatActivity,
    )),
  );
  $heartbeatActivity->content['buttons'] = array(
    '#markup' => theme('heartbeat_buttons', array(
      'heartbeat_activity' => $heartbeatActivity,
    )),
  );
  $heartbeatActivity->content['attachments'] = array(
    '#markup' => theme('heartbeat_attachments', array(
      'heartbeat_activity' => $heartbeatActivity,
    )),
  );
}