data() table()
Show a comma-separated list of ids as their names, one per line.
table()->data($name, $data = [], $extra = [])Options
| Option | Meaning |
|---|---|
$data | Id => name map. |
(common options) | The common column options. |
Example
Code
$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);Notes
- An empty list prints
--All--(translated). - It also calls form(), so the table is wrapped in a form.
See also: table/link, form/multi_check_box