Altering select elements to include data-img-src I am trying to create a content type with select list options that are replaced by images that you can pick.

Plugin here http://rvera.github.io/image-picker/

How would I go about altering the option element to include the data-img-src option?

&lt;option data-img-src="img/01.png" value="1"&gt;  Page 1  &lt;/option&gt;


Any help would be appreciated.
Looking at:

http://api.drupal.org/api/drupal/includes%21form.inc/function/form_select_options/7

It appears there's no way to add your own attribute to the select option from the form builder.

You may need to override theme_select to call a custom select_options handler instead, that checks some of the form data and adds the attributes to the option element.

http://api.drupal.org/api/drupal/includes!form.inc/function/theme_select/7