79220281

Date: 2024-11-24 14:30:38
Score: 0.5
Natty:
Report link

I don't get the full idea, but I think you want to add the separator for every 2 items / list? What I am thinking is to create a custom item rendered using the $index.


<?= Html::checkboxList('field_name', '', [
    'organisation_name'       => 'Organisation Name',
    'organisation_vat_number' => 'Organisation VAT Number',
    'invoice_number'          => 'Invoice Number',
    'invoice_date'            => 'Invoice Date'
], [
    'item' => function ($index, $label, $name, $checked, $value) {
        $separator = ($index % 2 == 1) ? '<hr>' : '';
        return "<label class='form-control'>" . Html::checkbox($name, $checked, ['value' => $value]) . " $label</label>" . $separator;
    }
]) ?>

The result :

Html checkbox

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
Posted by: Prabowo Murti