language_process_language_select

language_process_language_select($element)

Processes a language select list form element.

Parameters

array $element: The form element to process.

Return value

array $element The processed form element.

File

core/modules/language/language.module, line 152
Add language handling functionality to Drupal.

Code

function language_process_language_select($element) {
  // Don't set the options if another module (translation for example) already
  // set the options.
  if (!isset($element['#options'])) {
    $element['#options'] = array();
    foreach (\Drupal::languageManager()->getLanguages($element['#languages']) as $langcode => $language) {
      $element['#options'][$langcode] = $language->isLocked() ? t('- @name -', array('@name' => $language->getName())) : $language->getName();
    }
  }
  return $element;
}
doc_Drupal
2016-10-29 09:23:03
Comments
Leave a Comment

Please login to continue.