You are here

public function ScannerForm::getLanguages in Search and Replace Scanner 8

Helper function to fetch languaged enabled on the site.

Return value

array The languages keyed by langcode, with an option "all" for all languages.

1 call to ScannerForm::getLanguages()
ScannerForm::buildForm in src/Form/ScannerForm.php
Form constructor.

File

src/Form/ScannerForm.php, line 324

Class

ScannerForm
Form for performing searching.

Namespace

Drupal\scanner\Form

Code

public function getLanguages() {
  $languages = \Drupal::languageManager()
    ->getLanguages();
  foreach ($languages as $language) {
    $langs[$language
      ->getId()] = $language
      ->getName();
  }
  $langs['all'] = $this
    ->t('All languages');
  return $langs;
}