Цю сторінку ще не перекладено українською, тому нижче англійська версія.

multi_check_box() html()

A bare group of check boxes from value => label pairs.

html()->multi_check_box($name, $values = [], $selected = [], $horizontal = true, $type = 2, $add_str = '', $translate = 0, $name_as_array = false, $extra = [])

Опції

ОпціяЗначення
$name, $values, $selectedName; value => label; checked values as keys (['k1' => 1]).
$horizontal, $type, $add_str, $translateAs for radio_box().
$name_as_arrayPost name[value]; otherwise each box posts name_value.

Приклад

Код

return html()->multi_check_box(['name' => 'days', 'values' => ['k1' => 'key1', 'k2' => 'key2'], 'selected' => ['k2' => 1], 'name_as_array' => 1]);

Примітки

  • Known bug, fixed behind a flag: with positional arguments $selected, $translate, $add_str and $name_as_array are ignored (only the array form reads them; common()->multi_check_box() passes them positionally). yf_html::$MULTI_CHECK_BOX_POSITIONAL = true ($PROJECT_CONF['html']['MULTI_CHECK_BOX_POSITIONAL'], Settings / Widget fixes; the 4.0 default) reads them when the array form does not set them.

Див. також: form/check_box, html/check_box