You are here

public static function AdminHelper::getOtherEnabledLanguages in Search and Replace Scanner 8

Get all enabled languages, excluding current language.

File

src/AdminHelper.php, line 38

Class

AdminHelper
Shared logic for use in the mdoule.

Namespace

Drupal\scanner

Code

public static function getOtherEnabledLanguages() {

  // Get the list of all languages.
  $language = \Drupal::languageManager()
    ->getCurrentLanguage();
  $languages = \Drupal::languageManager()
    ->getLanguages();
  $other_languages = [];

  // Add each enabled language, aside from the current language to an array.
  foreach ($languages as $field_language_code => $field_language) {
    if ($field_language_code != $language
      ->getId()) {
      $other_languages[$field_language_code] = $field_language
        ->getName();
    }
  }
  return $other_languages;
}