You are here

protected function Importer::updateStatus in GatherContent 8.4

Update item's status based on status id. Upload new status to GC.

1 call to Importer::updateStatus()
Importer::import in src/Import/Importer.php
Import a single GatherContent item to Drupal.

File

src/Import/Importer.php, line 133

Class

Importer
Class for handling import/update logic from GatherContent to Drupal.

Namespace

Drupal\gathercontent\Import

Code

protected function updateStatus(Item $item, $statusId) {
  if (!is_int($statusId)) {

    // User does not want to update status.
    return;
  }
  $status = $this->client
    ->projectStatusGet($item->projectId, $statusId);

  // Update only if status exists.
  if ($status !== NULL) {

    // Update status on GC.
    $this->client
      ->itemChooseStatusPost($item->id, $statusId);

    // Update status of item (will be uploaded to Drupal on import).
    $item->status = $status;
  }
}