You are here

public function LingotekSupportedLocalesController::content in Lingotek Translation 3.4.x

Same name and namespace in other branches
  1. 8.2 src/Controller/LingotekSupportedLocalesController.php \Drupal\lingotek\Controller\LingotekSupportedLocalesController::content()
  2. 4.0.x src/Controller/LingotekSupportedLocalesController.php \Drupal\lingotek\Controller\LingotekSupportedLocalesController::content()
  3. 3.0.x src/Controller/LingotekSupportedLocalesController.php \Drupal\lingotek\Controller\LingotekSupportedLocalesController::content()
  4. 3.1.x src/Controller/LingotekSupportedLocalesController.php \Drupal\lingotek\Controller\LingotekSupportedLocalesController::content()
  5. 3.2.x src/Controller/LingotekSupportedLocalesController.php \Drupal\lingotek\Controller\LingotekSupportedLocalesController::content()
  6. 3.3.x src/Controller/LingotekSupportedLocalesController.php \Drupal\lingotek\Controller\LingotekSupportedLocalesController::content()
  7. 3.5.x src/Controller/LingotekSupportedLocalesController.php \Drupal\lingotek\Controller\LingotekSupportedLocalesController::content()
  8. 3.6.x src/Controller/LingotekSupportedLocalesController.php \Drupal\lingotek\Controller\LingotekSupportedLocalesController::content()
  9. 3.7.x src/Controller/LingotekSupportedLocalesController.php \Drupal\lingotek\Controller\LingotekSupportedLocalesController::content()
  10. 3.8.x src/Controller/LingotekSupportedLocalesController.php \Drupal\lingotek\Controller\LingotekSupportedLocalesController::content()
1 string reference to 'LingotekSupportedLocalesController::content'
lingotek.routing.yml in ./lingotek.routing.yml
lingotek.routing.yml

File

src/Controller/LingotekSupportedLocalesController.php, line 12

Class

LingotekSupportedLocalesController

Namespace

Drupal\lingotek\Controller

Code

public function content() {
  $locales = $this->lingotek
    ->getLocalesInfo();
  ksort($locales);
  $build = [];
  $build['#attached']['library'][] = 'lingotek/lingotek.locales_listing';
  $build['filters'] = [
    '#type' => 'container',
    '#attributes' => [
      'class' => [
        'table-filter',
        'js-show',
      ],
    ],
  ];
  $build['filters']['text'] = [
    '#type' => 'search',
    '#title' => $this
      ->t('Filter'),
    '#title_display' => 'invisible',
    '#size' => 60,
    '#placeholder' => $this
      ->t('Filter per language, locale, or country'),
    '#attributes' => [
      'class' => [
        'locales-filter-text',
      ],
      'data-table' => '.locales-listing-table',
      'autocomplete' => 'off',
      'title' => $this
        ->t('Enter a code or name of any language, locale, or country to filter by.'),
    ],
  ];
  $build['locales'] = [
    '#type' => 'table',
    '#header' => [
      'code' => $this
        ->t('Code'),
      'language_code' => $this
        ->t('Language Code'),
      'title' => $this
        ->t('Title'),
      'language' => $this
        ->t('Language'),
      'country_code' => $this
        ->t('Country Code'),
      'country' => $this
        ->t('Country'),
    ],
    '#rows' => $locales,
    '#attributes' => [
      'class' => [
        'locales-listing-table',
      ],
    ],
  ];
  return $build;
}