You are here

public static function EtufHelper::getOtherEnabledLanguages in Entity Translation Unified Form 8

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

5 calls to EtufHelper::getOtherEnabledLanguages()
entity_translation_unified_form_node_form_preview in ./entity_translation_unified_form.module
Form submission handler for node_form_preview().
entity_translation_unified_form_node_form_submit in ./entity_translation_unified_form.module
Form submission handler for node_form().
entity_translation_unified_form_node_insert_other_language_fields in ./entity_translation_unified_form.module
Add all enabled language fields for a single field.
entity_translation_unified_form_page_attachments in ./entity_translation_unified_form.module
Implements hook_page_attachments().
template_preprocess_entity_translation_unified_form__a11y_accordion_tabs__wrapper in ./entity_translation_unified_form.theme.inc
Prepare field variables for the form wrapper template.

File

src/EtufHelper.php, line 39

Class

EtufHelper
Helper class for the Etuf module.

Namespace

Drupal\entity_translation_unified_form

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