You are here

public function StatusHeartPost::sendRequest in Heartbeat 8

Overrides SharedContentInterface::sendRequest

File

modules/statusmessage/src/StatusHeartPost.php, line 42

Class

StatusHeartPost
@property \Drupal\statusmessage\MarkupGenerator generator @property message

Namespace

Drupal\statusmessage

Code

public function sendRequest() {
  if ($this
    ->generateRequest()) {
    $node = $this
      ->setNodeData();
    $tags = $this
      ->processTerms();
    if ($fids = $this
      ->getMedia()) {
      $node
        ->set('field_image', $fids);
    }
    if (!empty($this->tags)) {
      $node
        ->set('field_tags', $this->tags);
    }
    if ($node
      ->save()) {
      return $node
        ->id();
    }
  }
}