You are here

public function MappingCreator::getProjects in GatherContent 8.5

Returns all projects for given account.

Return value

array

File

gathercontent_upload/src/Export/MappingCreator.php, line 455

Class

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

Namespace

Drupal\gathercontent_upload\Export

Code

public function getProjects() {
  $accountId = DrupalGatherContentClient::getAccountId();

  /** @var \Cheppers\GatherContent\DataTypes\Project[] $projects */
  $projects = [];
  if ($accountId) {
    $projects = $this->client
      ->getActiveProjects($accountId);
  }
  $formattedProjects = [];
  foreach ($projects['data'] as $project) {
    $formattedProjects[$project->id] = $project->name;
  }
  return $formattedProjects;
}