How to set my template and labelOptions in Select2 in Yii2? For a regular field, this can be done via field->labelOptions and field->template. And how to do it for Select2?
$form->field($model, 'test',[
'labelOptions' => ['style' => 'display:none !important;'],
'template' => '{label}{input}{error}'])
->radioButtonGroup($data, ['itemOptions' => ['class' => 'btn btn-default', 'style' => 'display:none !important;']
]); ?>
Select2, which is in question: https://demos.krajee.com/widget-details/select2
I asked the question himself and answered it himself, and even in the question itself. It was enough to do as in the example from the question - set field->template and field->label Options as needed: