You are here

protected function ClientCdfLanguage::getLanguages in Acquia Content Hub 8.2

Get languages from the configurable language entity type manager.

Return value

array The array of languages.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 call to ClientCdfLanguage::getLanguages()
ClientCdfLanguage::onBuildClientCdf in src/EventSubscriber/ClientCdf/ClientCdfLanguage.php
Adds language information to ClientCDF documents.

File

src/EventSubscriber/ClientCdf/ClientCdfLanguage.php, line 104

Class

ClientCdfLanguage
Adds base url to all CDF documents.

Namespace

Drupal\acquia_contenthub\EventSubscriber\ClientCdf

Code

protected function getLanguages() {
  $languages = [];
  $lang_entities = $this->entityTypeManager
    ->getStorage('configurable_language')
    ->loadMultiple();
  foreach ($lang_entities as $langcode => $language) {
    $languages[$langcode] = $language
      ->toArray();

    // Cleanup Extra lines for efficient storage in Plexus.
    unset($languages[$langcode]['_core'], $languages[$langcode]['dependencies']);
  }
  return $languages;
}