You are here

public function LingotekApi::listProjects in Lingotek Translation 7.4

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

Gets available Lingotek projects.

Parameters

$reset: A boolean value to determin whether we need to query the API

Return value

array An array of available projects with project IDs as keys, project labels as values.

File

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

Class

LingotekApi
@file Defines Drupal\lingotek\LingotekApi

Code

public function listProjects($reset = FALSE) {
  $projects = variable_get('lingotek_project_defaults', array());
  if (!empty($projects) && $reset == FALSE) {
    return $projects;
  }
  if ($projects_raw = $this
    ->request('listProjects')) {
    $projects = array();
    foreach ($projects_raw->projects as $project) {
      $projects[$project->id] = $project->name;
    }
    variable_set('lingotek_project_defaults', $projects);
  }
  return $projects;
}