<p dir="auto">I currently use due to meet this challenge.</p>
<p dir="auto">Eg.</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="        $builder-&gt;addEventListener(FormEvents::POST_SET_DATA, function(FormEvent $event)
        {
            $data = $event-&gt;getData();
            $form = $event-&gt;getForm();

            $formDisponibility = $form-&gt;get(&quot;disponibility&quot;);

            $choiceListOption  = $form-&gt;get(&quot;disponibility&quot;)-&gt;getConfig()-&gt;getOption(&quot;choice_list&quot;);

            $choices = $choiceListOption-&gt;getChoices();

            $views = $choiceListOption-&gt;getRemainingViews();

            foreach($choices as $key =&gt; $choice)
            {
                $view = $views[$key];

                $view-&gt;attr = array(&quot;data-day&quot; =&gt; $choice-&gt;getDay());
            }

        });"><pre class="notranslate">        <span class="pl-s1"><span class="pl-c1">$</span>builder</span>-&gt;<span class="pl-en">addEventListener</span>(<span class="pl-v">FormEvents</span>::<span class="pl-c1">POST_SET_DATA</span>, <span class="pl-k">function</span>(<span class="pl-smi"><span class="pl-smi">FormEvent</span></span> <span class="pl-s1"><span class="pl-c1">$</span>event</span>)
        {
            <span class="pl-s1"><span class="pl-c1">$</span>data</span> = <span class="pl-s1"><span class="pl-c1">$</span>event</span>-&gt;<span class="pl-en">getData</span>();
            <span class="pl-s1"><span class="pl-c1">$</span>form</span> = <span class="pl-s1"><span class="pl-c1">$</span>event</span>-&gt;<span class="pl-en">getForm</span>();

            <span class="pl-s1"><span class="pl-c1">$</span>formDisponibility</span> = <span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">get</span>("<span class="pl-s">disponibility</span>");

            <span class="pl-s1"><span class="pl-c1">$</span>choiceListOption</span>  = <span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">get</span>("<span class="pl-s">disponibility</span>")-&gt;<span class="pl-en">getConfig</span>()-&gt;<span class="pl-en">getOption</span>("<span class="pl-s">choice_list</span>");

            <span class="pl-s1"><span class="pl-c1">$</span>choices</span> = <span class="pl-s1"><span class="pl-c1">$</span>choiceListOption</span>-&gt;<span class="pl-en">getChoices</span>();

            <span class="pl-s1"><span class="pl-c1">$</span>views</span> = <span class="pl-s1"><span class="pl-c1">$</span>choiceListOption</span>-&gt;<span class="pl-en">getRemainingViews</span>();

            <span class="pl-k">foreach</span>(<span class="pl-s1"><span class="pl-c1">$</span>choices</span> <span class="pl-k">as</span> <span class="pl-s1"><span class="pl-c1">$</span>key</span> =&gt; <span class="pl-s1"><span class="pl-c1">$</span>choice</span>)
            {
                <span class="pl-s1"><span class="pl-c1">$</span>view</span> = <span class="pl-s1"><span class="pl-c1">$</span>views</span>[<span class="pl-s1"><span class="pl-c1">$</span>key</span>];

                <span class="pl-s1"><span class="pl-c1">$</span>view</span>-&gt;<span class="pl-c1">attr</span> = <span class="pl-en">array</span>("<span class="pl-s">data-day</span>" =&gt; <span class="pl-s1"><span class="pl-c1">$</span>choice</span>-&gt;<span class="pl-en">getDay</span>());
            }

        });</pre></div>
<p dir="auto">It would be nice to be able to define extra HTML attributes for choices in a choice list that are added to the <code class="notranslate">option</code> or <code class="notranslate">input</code> tags.</p>
<p dir="auto">Origin of this ticket: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3393283" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/3456" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/3456/hovercard" href="https://github.com/symfony/symfony/issues/3456">#3456</a></p>