You are here

protected function Lingotek::getResource in Lingotek Translation 3.4.x

Same name and namespace in other branches
  1. 8 src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  2. 8.2 src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  3. 4.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  4. 3.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  5. 3.1.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  6. 3.2.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  7. 3.3.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  8. 3.5.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  9. 3.6.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  10. 3.7.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  11. 3.8.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
4 calls to Lingotek::getResource()
Lingotek::getFilters in src/Lingotek.php
Get all the available filters.
Lingotek::getProjects in src/Lingotek.php
Gets the account related projects.
Lingotek::getVaults in src/Lingotek.php
Gets the account related vaults.
Lingotek::getWorkflows in src/Lingotek.php
Gets the account related workflows.

File

src/Lingotek.php, line 654

Class

Lingotek
The connecting class between Drupal and Lingotek

Namespace

Drupal\lingotek

Code

protected function getResource($resources_key, $func, $force = FALSE) {
  $data = $this->configFactory
    ->get(static::SETTINGS)
    ->get($resources_key);
  if (empty($data) || $force) {
    $community_id = $this->configFactory
      ->get(static::SETTINGS)
      ->get('default.community');
    $data = $this->api
      ->{$func}($community_id);
    $this->configFactory
      ->getEditable(static::SETTINGS)
      ->set($resources_key, $data)
      ->save();
    $keys = explode(".", $resources_key);
    $default_key = 'default.' . end($keys);
    $this
      ->setValidDefaultIfNotSet($default_key, $data);
  }
  return $data;
}