You are here

protected function Lingotek::getResource in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  2. 4.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  3. 3.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  4. 3.1.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  5. 3.2.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  6. 3.3.x src/Lingotek.php \Drupal\lingotek\Lingotek::getResource()
  7. 3.4.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()
3 calls to Lingotek::getResource()
Lingotek::getProjects in src/Lingotek.php
Lingotek::getVaults in src/Lingotek.php
Lingotek::getWorkflows in src/Lingotek.php

File

src/Lingotek.php, line 272
Contains \Drupal\lingotek\Lingotek.

Class

Lingotek

Namespace

Drupal\lingotek

Code

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