How to show font awesome icon in symfony form select
<p>I Want to show all font awesome icon in select option with Symfony Form Builder.</p>

<p>I add the select field with : </p>

<pre><code>$choices = $this-&gt;getFontAwesome();
$form-&gt;add( $key, ChoiceType::class, array('label' =&gt; 'Texte', 'choices' =&gt; $choices, 'attr' =&gt; array('class' =&gt; "fa" ) ) );
</code></pre>

<p>My Function getFontAwesome();</p>

<pre><code>    public function getFontAwesome(){

    $webroot = $this-&gt;get('kernel')-&gt;getRootDir() . '/../web';
    $pattern = '/\.(fa-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"\\\\(.+)";\s+}/';
    $subject =  file_get_contents( $webroot . '/assets/vendor/font-awesome/css/font-awesome.css');
    preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
    foreach($matches as $match) {
        $icons[$match[1]] = '&amp;#x' . $match[2] . ';' ;
    }

    return $icons ;

}
</code></pre>

<p>But in the select field, don't see the icon:</p>

<p>Field show the code and not the icon</p>

<p><a href="https://i.stack.imgur.com/QJklu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QJklu.png" alt="enter image description here"></a></p>

<p>How i can do ?
I Try htmlspecialschars and others ( htmlentities, .. ) but don't work.</p>