You are here

public function HeartbeatActivity::save in Heartbeat 6.4

Same name and namespace in other branches
  1. 6.3 includes/heartbeatactivity.inc \HeartbeatActivity::save()
  2. 7 includes/heartbeatactivity.inc \HeartbeatActivity::save()

Public function to save activity to database

Parameters

array raw argument to enforce as is (pre-renderd):

File

includes/heartbeatactivity.inc, line 296
HeartbeatActivity object Defines one heartbeat activity object.

Class

HeartbeatActivity
Class defines an activity message object

Code

public function save($raw_args = array()) {
  $locale = module_exists('locale');
  if (!empty($this->nid)) {
    $node = node_load($this->nid);

    // Add extra node access information for nid.
    if (empty($this->nid_info)) {

      // Add extra node access information for nid.
      $this->nid_info = array(
        'uid' => $node->uid,
        'type' => $node->type,
        'format' => $node->format,
      );
    }
  }
  if (!empty($this->nid_target)) {
    $node_target = node_load($this->nid_target);

    // Add extra node access information for nid_target.
    $this->nid_target_info = array(
      'uid' => $node_target->uid,
      'type' => $node_target->type,
      'format' => $node_target->format,
    );
  }

  // if a user selected a language, then we follow i19n.
  if (isset($node) && !empty($node->language)) {
    return $this
      ->_save($raw_args, $node->language);
  }
  if ($locale) {
    return $this
      ->save_locale($raw_args);
  }
  else {
    return $this
      ->_save($raw_args);
  }
}