You are here

protected function ContentLanguageAccessTestBase::getLanguageList in Content Language Access 8

Returns the list of languages available.

Parameters

bool $with_neutral_language: Optional, specifies if the function needs to return also the neutral language.

Return value

\Drupal\Core\Language\LanguageInterface[] With all the languages available (plus the neutral language)

2 calls to ContentLanguageAccessTestBase::getLanguageList()
ContentLanguageAccessTestBase::baseTestContentLanguageAccess in src/Tests/ContentLanguageAccessTestBase.php
Tests each content in each language.
ContentLanguageAccessTestBase::createContents in src/Tests/ContentLanguageAccessTestBase.php
Creates a content for each language for the tests.

File

src/Tests/ContentLanguageAccessTestBase.php, line 139

Class

ContentLanguageAccessTestBase
Test the features of content_language_access module.

Namespace

Drupal\content_language_access\Tests

Code

protected function getLanguageList($with_neutral_language = TRUE) {
  $languages = Drupal::languageManager()
    ->getLanguages();
  if ($with_neutral_language) {
    $languages[Language::LANGCODE_NOT_SPECIFIED] = new Language([
      'id' => Language::LANGCODE_NOT_SPECIFIED,
      'name' => 'Language Neutral',
    ]);
  }
  return $languages;
}