You are here

public function DrupalGatherContentClient::getTemplatesOptionArray in GatherContent 8.5

Same name and namespace in other branches
  1. 8.4 src/DrupalGatherContentClient.php \Drupal\gathercontent\DrupalGatherContentClient::getTemplatesOptionArray()

Returns a formatted array with the template ID's as a key.

Parameters

int $projectId: Project ID.

Return value

array Return array.

File

src/DrupalGatherContentClient.php, line 86

Class

DrupalGatherContentClient
Extends the GatherContentClient class with Drupal specific functionality.

Namespace

Drupal\gathercontent

Code

public function getTemplatesOptionArray($projectId) {
  $formatted = [];
  $templates = $this
    ->templatesGet($projectId);
  foreach ($templates['data'] as $template) {
    $formatted[$template->id] = $template->name;
  }
  return $formatted;
}