public function LingotekApi::listVaults in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listVaults()
- 7.2 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listVaults()
- 7.3 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listVaults()
- 7.4 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listVaults()
- 7.5 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listVaults()
Gets available Lingotek Translation Memory Vaults.
Parameters
$reset: A boolean value to determin whether we need to query the API
Return value
array An array of available vaults.
File
- lib/
Drupal/ lingotek/ LingotekApi.php, line 755 - Defines Drupal\lingotek\LingotekApi
Class
- LingotekApi
- @file Defines Drupal\lingotek\LingotekApi
Code
public function listVaults($reset = FALSE, $show_public_vaults = FALSE) {
$vaults = variable_get('lingotek_vaults_defaults', array());
if (!empty($vaults) && $reset == FALSE) {
return $vaults;
}
if ($vaults_raw = $this
->request('listTMVaults')) {
$vaults = array();
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 ($show_public_vaults && !empty($vaults_raw->publicVaults)) {
foreach ($vaults_raw->publicVaults as $vault) {
$vaults['Public Vaults'][$vault->id] = $vault->name;
}
}
variable_set('lingotek_vaults_defaults', $vaults);
}
return $vaults;
}