icon() table()

Show an icon from an icon class name (icon-*) or an image file of uploads/icons/.

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

Options

OptionMeaning
(common options)The common column options.

Example

Icon Name
Home
Settings
No icon

Code

$rows = [
    1 => ['id' => 1, 'name' => 'Home', 'icon' => 'icon-home'],
    2 => ['id' => 2, 'name' => 'Settings', 'icon' => 'icon-cog'],
    3 => ['id' => 3, 'name' => 'No icon', 'icon' => ''],
];
return table($rows, ['no_pages' => 1])
    ->icon('icon')
    ->text('name');

Notes

  • A value that is not an icon-* class is looked up as a file in uploads/icons/ of the project; a missing file prints nothing.
  • It also calls form().

See also: form/icon_select_box, html/icon