table/form
< >

return function () {
    $self = url('/@object/@action/' . urlencode('table/form'));
    // the row buttons link back here: the demo only reports the click, nothing is edited
    $act = preg_replace('~[^a-z]~', '', (string) ($_GET['act'] ?? ''));
    $notice = $act ? '<div class="alert alert-info">Button <b>' . $act . '</b>' . (isset($_GET['row']) ? ' of row <b>' . (int) $_GET['row'] . '</b>' : '') . ' was clicked (the demo only shows it).</div>' : '';
    $data = json_decode(file_get_contents(__DIR__ . '/products.json'), true);
    foreach ((array) $data as $k => $v) {
        $data[$k]['stars'] = rand(1, 5);
        $data[$k]['stars_big'] = rand(10, 40);
    }
    return $notice . table($data)
        ->form($self)
        ->stars('stars')
        ->stars('stars_big', ['stars' => 5, 'max' => 100])

        ->check_box('id', ['header_tip' => 'This is checkbox'])
        ->select_box('id', ['values' => ['', 'k1' => 'v1', 'k2' => 'v2'], 'selected' => 'k1', 'tip' => 'Checkbox value tip', 'nowrap' => 1, 'class' => 'input-small'])
        ->radio_box('id')
        ->input('id', ['class' => 'input-small'])

        ->image('id', 'uploads/shop/products/{subdir2}/{subdir3}/product_%d_1_thumb.jpg', ['width' => '50px'])
        ->text('name')
        ->link('cat_id', url('/@object/@action/' . urlencode('table/products')), _class('cats')->_get_items_names('shop_cats'))
        ->text('price')
        ->text('quantity')
        ->date('add_date')
        ->date('add_date', ['format' => '%y-%m-%d %H:%M'])
        ->btn_edit(['icon' => 'icon-star', 'link' => $self . '?act=edit&row=%d', 'no_ajax' => 1])
        ->btn_delete(['link' => $self . '?act=delete&row=%d', 'no_ajax' => 1])
        ->btn_clone(['link' => $self . '?act=clone&row=%d', 'no_ajax' => 1])
        ->btn_active(['link' => $self . '?act=active&row=%d'])
        ->footer_add(['link' => $self . '?act=add', 'no_ajax' => 1]);
};
Button add was clicked (the demo only shows it).
Stars Stars big Id   Id Id Id Image Name Cat id Price Quantity Add date Add date Actions
   Archives T-shirt, black 10077 37.00 0 09/27/13 13-09-27 12:26 Edit Delete Clone Active
   Archives T-shirt, navy 10077 37.00 0 09/30/13 13-09-30 17:08 Edit Delete Clone Active
   Archives T-shirt, purple 10077 37.00 0 10/02/13 13-10-02 10:57 Edit Delete Clone Active
   Attacker T-shirt, white 10077 37.00 0 09/29/13 13-09-29 15:34 Edit Delete Clone Active
   Blamo T-shirt, black 10077 37.00 0 10/01/13 13-10-01 11:01 Edit Delete Clone Active
   Blamo T-shirt, white 10077 37.00 0 10/03/13 13-10-03 01:38 Edit Delete Clone Active
   Blamo T-shirt, black and green 10077 37.00 0 09/27/13 13-09-27 04:52 Edit Delete Clone Active
   Paint Bucket T-shirt, green 10077 37.00 0 09/28/13 13-09-28 16:35 Edit Delete Clone Active
   Paint Bucket T-shirt, white 10077 37.00 0 09/30/13 13-09-30 23:18 Edit Delete Clone Active
   Paint Bucket T-shirt, purple 10077 37.00 0 09/28/13 13-09-28 22:52 Edit Delete Clone Active
   Flash T-shirt, white 10077 35.00 0 09/27/13 13-09-27 13:45 Edit Delete Clone Active
   Mix Tape T-shirt, black 10077 45.00 0 09/29/13 13-09-29 04:58 Edit Delete Clone Active
   Winner T-shirt, grey 10077 35.00 0 10/02/13 13-10-02 15:56 Edit Delete Clone Active
   Hill T-shirt, white 10077 35.00 0 10/01/13 13-10-01 16:48 Edit Delete Clone Active
   Roseheart T-shirt, black 10077 35.00 0 Edit Delete Clone Active
   Liberty T-shirt, black 10077 35.00 0 Edit Delete Clone Active
   Pray Skull T-shirt, black 10077 35.00 0 Edit Delete Clone Active
   Blood Head T-shirt, black 10077 40.00 0 Edit Delete Clone Active
   Outlaw T-shirt, black 10077 40.00 0 Edit Delete Clone Active
   Random T-shirt, black 10077 40.00 0 Edit Delete Clone Active