You are here

protected function AdminUserLanguageBrowserTestBase::getActiveLanguages in Admin User Language 8

Gets the active languages.

Return value

array

2 calls to AdminUserLanguageBrowserTestBase::getActiveLanguages()
AdminUserLanguageBaseFormTest::testBasicFormSettings in tests/src/Functional/AdminUserLanguageBaseFormTest.php
Tests the basic functionality of the field.
AdminUserLanguageUserTest::testCoreFunctionalityOnUserRegistrationAndEdit in tests/src/Functional/AdminUserLanguageUserTest.php
Test if an admin language is correctly set on user registration or edit.

File

tests/src/Functional/AdminUserLanguageBrowserTestBase.php, line 41

Class

AdminUserLanguageBrowserTestBase
Class AdminUserLanguageBrowserTestBase

Namespace

Drupal\Tests\admin_user_language\Functional

Code

protected function getActiveLanguages() {
  $languages = (array) \Drupal::service('language_manager')
    ->getLanguages();
  $displayLanguages = [];

  /** @var \Drupal\Core\Language\Language $lang */
  foreach ($languages as $lang) {
    $displayLanguages[$lang
      ->getId()] = $lang
      ->getName();
  }
  return $displayLanguages;
}