lang() table()

Show a language code with the flag of its default country.

table()->lang($name, $data = [], $extra = [])

Options

OptionMeaning
(common options)The common column options.

Example

Title Language
Welcome  EN
Ласкаво просимо  UK
Willkommen  DE

Code

$rows = [
    1 => ['id' => 1, 'title' => 'Welcome', 'locale' => 'en'],
    2 => ['id' => 2, 'title' => 'Ласкаво просимо', 'locale' => 'uk'],
    3 => ['id' => 3, 'title' => 'Willkommen', 'locale' => 'de'],
];
return table($rows, ['no_pages' => 1])
    ->text('title')
    ->lang('locale', [], ['desc' => 'Language']);

Notes

  • The country comes from the lang_def_country data handler; the flags are the bfh-flag-* sprites of the bfh-select asset.

See also: form/language_box, html/icon