You are here

public static function AdminHelper::getAllEnabledLanguages 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::getAllEnabledLanguages()
  2. 1.0.x src/AdminHelper.php \Drupal\moderated_content_bulk_publish\AdminHelper::getAllEnabledLanguages()

Helper function to get all enabled languages, including the current language.

4 calls to AdminHelper::getAllEnabledLanguages()
AdminModeration::publish in src/AdminModeration.php
Publish Latest Revision.
AdminModeration::unpublish in src/AdminModeration.php
Unpublish current revision.
AdminPin::pin in src/AdminPin.php
Pin Content.
AdminPin::unpin in src/AdminPin.php
Unpin current revision.

File

src/AdminHelper.php, line 47

Class

AdminHelper

Namespace

Drupal\moderated_content_bulk_publish

Code

public static function getAllEnabledLanguages() {

  // 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) {
    $other_languages[$field_language_code] = $field_language
      ->getName();
  }
  return $other_languages;
}