You are here

public static function AdminHelper::getOtherEnabledLanguages in moderated content bulk publish 8

Same name and namespace in other branches
  1. 2.0.x src/AdminHelper.php \Drupal\moderated_content_bulk_publish\AdminHelper::getOtherEnabledLanguages()
  2. 1.0.x src/AdminHelper.php \Drupal\moderated_content_bulk_publish\AdminHelper::getOtherEnabledLanguages()

Helper function to get all enabled languages, excluding current language.

File

src/AdminHelper.php, line 21

Class

AdminHelper

Namespace

Drupal\moderated_content_bulk_publish

Code

public static function getOtherEnabledLanguages() {

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

  // 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;
}