You are here

public function LingotekApi::getFilters in Lingotek Translation 4.0.x

Same name and namespace in other branches
  1. 8.2 src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getFilters()
  2. 3.0.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getFilters()
  3. 3.1.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getFilters()
  4. 3.2.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getFilters()
  5. 3.3.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getFilters()
  6. 3.4.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getFilters()
  7. 3.5.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getFilters()
  8. 3.6.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getFilters()
  9. 3.7.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getFilters()
  10. 3.8.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getFilters()

Get the available filters on Lingotek.

Return value

array|bool Array of filters as in (id, label). FALSE if there is an error.

Overrides LingotekApiInterface::getFilters

File

src/Remote/LingotekApi.php, line 509

Class

LingotekApi
A simple connector to the Lingotek Translation API.

Namespace

Drupal\lingotek\Remote

Code

public function getFilters() {
  try {
    $this->logger
      ->debug('Lingotek::getFilters called.');
    $response = $this->lingotekClient
      ->get('/api/filter', [
      'limit' => 1000,
    ]);
  } catch (\Exception $e) {
    throw new LingotekApiException('Failed to get filters: ' . $e
      ->getMessage());
  }
  return $this
    ->formatResponse($response);
}