You are here

protected function DrupalGatherContentClient::reKeyArray in GatherContent 8.5

Create new assoc array with the key parameter as array key.

Parameters

array $array: Array to re-key.

string $key: The key to re-key by.

Return value

array Returns the re-keyed array.

3 calls to DrupalGatherContentClient::reKeyArray()
DrupalGatherContentClient::getActiveProjects in src/DrupalGatherContentClient.php
Retrieve all the active projects.
DrupalGatherContentClient::projectStatusesGet in src/DrupalGatherContentClient.php
DrupalGatherContentClient::templateGet in src/DrupalGatherContentClient.php

File

src/DrupalGatherContentClient.php, line 246

Class

DrupalGatherContentClient
Extends the GatherContentClient class with Drupal specific functionality.

Namespace

Drupal\gathercontent

Code

protected function reKeyArray(array $array, $key) {
  $items = [];
  foreach ($array as $item) {
    $items[$item->{$key}] = $item;
  }
  return $items;
}