You are here

function allowed_languages_get_language_options in Allowed Languages 2.x

Same name and namespace in other branches
  1. 8 allowed_languages.module \allowed_languages_get_language_options()

Get an array of languages to use with the allowed language checkboxes.

Return value

array An array of languages keyed by id => name.

2 calls to allowed_languages_get_language_options()
AllowedLanguagesUserFieldTest::testAllowedLanguagesGetLanguageOptions in tests/src/Kernel/AllowedLanguagesUserFieldTest.php
Test the function to get allowed language options.
allowed_languages_form_user_form_alter in ./allowed_languages.module
Add the allowed languages checkboxes to the user form.

File

./allowed_languages.module, line 186
Contains allowed_languages.module.

Code

function allowed_languages_get_language_options() {
  $element = [
    '#languages' => LanguageInterface::STATE_CONFIGURABLE,
  ];
  $language_element = language_process_language_select($element);
  $language_options = $language_element['#options'];
  asort($language_options);
  return $language_options;
}