You are here

public function LingotekApi::listVaults in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.7 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listVaults()
  2. 7.2 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listVaults()
  3. 7.4 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listVaults()
  4. 7.5 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listVaults()
  5. 7.6 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listVaults()

Gets available Lingotek Translation Memory vaults.

Return value

array An array of available vaults.

File

lib/Drupal/lingotek/LingotekApi.php, line 805
Defines Drupal\lingotek\LingotekApi

Class

LingotekApi
@file Defines Drupal\lingotek\LingotekApi

Code

public function listVaults() {
  $vaults = array();
  if ($vaults_raw = $this
    ->request('listTMVaults')) {
    if (!empty($vaults_raw->personalVaults)) {
      foreach ($vaults_raw->personalVaults as $vault) {
        $vaults['Personal Vaults'][$vault->id] = $vault->name;
      }
    }
    if (!empty($vaults_raw->communityVaults)) {
      foreach ($vaults_raw->communityVaults as $vault) {
        $vaults['Community Vaults'][$vault->id] = $vault->name;
      }
    }
    if (!empty($vaults_raw->publicVaults)) {
      foreach ($vaults_raw->publicVaults as $vault) {
        $vaults['Public Vaults'][$vault->id] = $vault->name;
      }
    }
  }
  return $vaults;
}