ZF2 Add custom attribute to option in a select form element
问题 I would like to add a custom HTML attribute to an option of a select in a Zend Framework 2 Form. This is my (partial) code from my Form class: $this->add(array( 'name' => 'lieuRemplissage', 'type' => 'Select', 'attributes' => array( 'class' => 'form-control', ), 'options' => array( 'label' => _('Lieu pré-enregistré'), ), )); I populate my options values in my controller like this : $form = new \Vente\Form\Vente; foreach($this->getAdminLieuDeVenteTable()->fetchAll() as $lieu) { $optionsLieu[