You are here

public function Lingotek::getCommunities in Lingotek Translation 3.4.x

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

Gets the account related communities.

Parameters

bool $force: Flag indicating if it must be forced to request from the API. If false, will use local cached data.

Return value

array|bool Array with communities information. FALSE in case of error. The keys are the ids, and values are the name of the resource.

Overrides LingotekInterface::getCommunities

1 call to Lingotek::getCommunities()
Lingotek::getResources in src/Lingotek.php
Gets the account related resources.

File

src/Lingotek.php, line 167

Class

Lingotek
The connecting class between Drupal and Lingotek

Namespace

Drupal\lingotek

Code

public function getCommunities($force = FALSE) {
  $resources_key = 'account.resources.community';
  $data = $this->configFactory
    ->get(static::SETTINGS)
    ->get($resources_key);
  if (empty($data) || $force) {
    $data = $this->api
      ->getCommunities($force);
    $this->configFactory
      ->getEditable(static::SETTINGS)
      ->set($resources_key, $data)
      ->save();
  }
  return $data;
}