You are here

public function LegalLanguageSettings::buildForm in Legal 8

Same name and namespace in other branches
  1. 2.0.x src/Form/LegalLanguageSettings.php \Drupal\legal\Form\LegalLanguageSettings::buildForm()

Languages administration form.

Overrides FormInterface::buildForm

File

src/Form/LegalLanguageSettings.php, line 54

Class

LegalLanguageSettings
Class LegalLanguageSettings.

Namespace

Drupal\legal\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $latest_header = [
    $this
      ->t('Language'),
    $this
      ->t('Version'),
    $this
      ->t('Revision'),
  ];
  $latest_rows = $this
    ->legalVersionsLatestGet();
  $rows = [];
  foreach ($latest_rows as $language_name => $language) {
    $row = [];
    $row[] = new HtmlEscapedText($language_name);
    $row[] = empty($language['version']) ? '-' : $language['version'];
    $row[] = empty($language['revision']) ? '-' : $language['revision'];
    $rows[] = $row;
  }
  $form['latest'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Latest Version'),
  ];
  $form['latest']['#value'] = [
    '#type' => 'table',
    '#header' => $latest_header,
    '#rows' => $rows,
  ];
  return $form;
}