You are here

public function HeartbeatStream::executeViews in Heartbeat 7

executeViews().

Method to represent the messages if comes from views.

File

includes/heartbeatstream.inc, line 880
HeartbeatStream object is the object that takes stream configuration to create a stream of activity objects. It is the controlling organ at the pre-query, query and post-query phases.

Class

HeartbeatStream
Abstract class HeartbeatStream This base class has final template methods which are used by the derived concretes. The HeartbeatStream is a state object that is given to the HeartbeatStreamBuilder to set the access to the current request.

Code

public function executeViews($values = NULL) {
  $activities = heartbeat_activity_load_multiple($values);
  if (empty($activities)) {
    return;
  }

  // Filter messages by permission, skipped for views for now.
  // $this->checkAccess($activities);
  // Give contributes modules the opportunity to load
  // additions for the heartbeat activity message object
  $hook = 'heartbeat_load';
  foreach (module_implements($hook) as $module) {
    $function = $module . '_' . $hook;

    // $messages should be implemented by reference!!!
    $function($activities, $this);
  }

  // Group the activity messages as configured
  $messages = $this
    ->parseMessages($activities);

  // Let other modules retheme or completely rebuild messages
  $hook = 'heartbeat_theme_alter';
  foreach (module_implements($hook) as $module) {
    $function = $module . '_' . $hook;
    $function($messages, $this);
  }
  $this->messages = $messages;
  $messages = array();
  foreach ($this->messages as $message) {
    $messages[$message->uaid] = $message;
  }
  return $messages;
}