data() table()
Show a comma-separated list of ids as their names, one per line.
table()->data($name, $data = [], $extra = [])Опції
| Опція | Значення |
|---|---|
$data | Id => name map. |
(common options) | The common column options. |
Приклад
Код
$groups = [1 => 'Admins', 2 => 'Editors', 3 => 'Support'];
$rows = [
1 => ['id' => 1, 'login' => 'anna', 'groups' => '1,2'],
2 => ['id' => 2, 'login' => 'bohdan', 'groups' => '3'],
3 => ['id' => 3, 'login' => 'olena', 'groups' => ''],
];
return table($rows, ['no_pages' => 1])
->text('login')
->data('groups', $groups);Примітки
- An empty list prints
--All--(translated). - It also calls form(), so the table is wrapped in a form.
Див. також: table/link, form/multi_check_box