ActiveForm CheckboxList population

I’m sure this question has been answered 100 times already, and I know I’ve stared the answer in the face on multiple occasions and haven’t been able to connect the dots. So here goes, thanks in advance.

I have an active form, in which I want to display a bunch of checkbox’s. Some of these checkboxes need to be checked based on an id array in the model.

Here is my simple form with only the checkbox list. I’m using ActiveForm





<?php $form = ActiveForm::begin(); ?>


<?= $form->field($model, 'permission_ids')->checkboxList($permissionOptions); ?>


<?php ActiveForm::end(); ?>



This currently displays the checkboxes with the labels, but none are checked.

$model =

[permission_ids] =&gt; [


    0 =&gt; 1


    1 =&gt; 2


]


[brand_ids] =&gt; []

$permissionOptions =

[

1 =&gt; 'Full Administrator'


2 =&gt; 'Create, Edit &amp; Delete Calendar Entries'


3 =&gt; 'Create, Edit &amp; Delete Tasks'


...

]

I’m positive the answer to my question lies right in this Post

But I just cant figure it out in my own context.

So the question is, how do I have the checkboxes render checked based on the permission_ids array values( 1 and 2) in the model?