info(), info_date(), info_link(), info_lang() form()

Read-only rows: a value as a label (info()), a formatted date (info_date()), a link (info_link()), a language with its flag (info_lang()).

form()->info($name, $desc = '', $extra = [], $replace = [])
form()->info_date($name = '', $format = '', $extra = [], $replace = [])
form()->info_link($name = '', $link = '', $extra = [], $replace = [])
form()->info_lang($name = '', $extra = [], $replace = [])

Options

OptionMeaning
valueShown when $replace[name] is empty.
dataValue => text map.
link, rewriteMake the value a link (info_link() takes it from the second argument or $replace[name]); rewrite passes it through url().
formatinfo_date(): short, long, full or a pattern, as table()->date(). Pass it in the options: the second argument is also used as the label (known bug) unless form2::$CONF_INFO_DATE_FORMAT_NOT_DESC is on (Settings / Widget fixes; the 4.0 default).
class, badge, label, iconLook of the value: default CLASS_LABEL_INFO; a badge or label colour (or a value => colour map; a value the map lacks keeps the default class). A class map that lacks the value prints class=" Array" with a PHP warning unless form2::$CONF_MAP_MISS_PLAIN is on (Settings / Widget fixes; the 4.0 default).
no_escape, no_translate, no_text, no_labelPrint HTML as it is; do not translate; no value; no label.

Example

42
Paid
11/02/26 09:11
 UK

Code

$row = ['id' => 42, 'status' => 'paid', 'add_date' => '2026-11-02 09:15:00', 'site' => 'https://example.com', 'lang' => 'uk'];
return form($row)
    ->info('id', 'Order')
    ->info('status', ['data' => ['new' => 'New', 'paid' => 'Paid'], 'label' => ['new' => 'warning', 'paid' => 'success']])
    ->info_date('add_date', ['format' => 'long', 'desc' => 'Added'])
    ->info_link('site', '', ['desc' => 'Web site', 'target' => '_blank'])
    ->info_lang('lang', ['desc' => 'Language']);

Notes

  • Values are escaped (no_escape turns it off for trusted HTML) and translated with t() unless no_translate.
  • In the admin a link the admin group may not open is shown as text.

Bootstrap 3 and 5

CLASS_LABEL_INFO is label label-info under Bootstrap 3 and badge text-bg-info under 5.

See also: form/user_info, form/link, table/date