Select2 in php forms?
It should work using the following format
$this-&gt;add('select', [YOUR CODE HERE] array('multiple' =&gt; TRUE, 'class' =&gt; 'crm-select2'));

https://docs.civicrm.org/dev/en/latest/framework/quickform/entityref/
https://select2.org/