check_box() table()

A check box in each row, posting field[value] (usually the ids of the rows to act on).

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

Options

OptionMeaning
namePosted name; default the field name; [value] is appended unless it holds a [.
descLabel next to the box; default none.
header_tipHelp popover in the header.
(html options)Every option of html()->check_box().

Example

   Name
Desk lamp
Office chair

Code

$rows = [
    1 => ['id' => 1, 'name' => 'Desk lamp'],
    2 => ['id' => 2, 'name' => 'Office chair'],
];
return table($rows, ['no_pages' => 1])
    ->check_box('id', ['desc' => '', 'header_tip' => 'Pick the rows to delete'])
    ->text('name')
    ->footer_submit('Delete selected', ['class' => 'btn btn-danger btn-sm']);

Notes

  • Ids are checkbox_<value>. It calls form().

See also: table/radio_box, html/check_box