You are here

public function HeartbeatActivityStatusPlugin::streamLoaded in Heartbeat 7

streamLoaded().

Overrides iHeartbeatPlugin::streamLoaded

File

modules/heartbeat_plugins/plugins/activitystatus.inc, line 81

Class

HeartbeatActivityStatusPlugin
Class HeartbeatActivityStatusPlugin.

Code

public function streamLoaded(HeartbeatStream $heartbeatStream) {
  if (!empty($heartbeatStream->config->settings['show_status_form']) && user_access('post activity statuses') && $heartbeatStream
    ->canPostActivityStatuses()) {
    $template = heartbeat_message_template_load($heartbeatStream->config->settings['show_status_form']);
    if ($template) {
      $heartbeatActivity = new HeartbeatActivity(array(
        'actor' => $GLOBALS['user'],
      ), $template);

      // Allow the stream to modify the HeartbeatActivity object.
      // This is mostly used to add some context to the logging.
      $heartbeatStream
        ->modifyActivityMessage($heartbeatActivity);
      $output = drupal_get_form('heartbeat_activity_form_' . $template->message_id, $heartbeatActivity, $heartbeatStream);

      // Add the form as prefix while wishing I'll find a better way.
      $heartbeatStream->prefix .= drupal_render($output);
    }
  }
}