Prefix html before radiobutton (input field) I'm looking to insert some extra html before an input radio button. This is my html now:

&lt;div id="edit-field-geslacht-und" class="form-radios"&gt;
    &lt;div class="form-item form-type-radio form-item-field-geslacht-und"&gt;
        &lt;input type="radio" id="edit-field-geslacht-und-female" name="field_geslacht[und]" value="female" class="form-radio"&gt;  
        &lt;label class="option" for="edit-field-geslacht-und-female"&gt;Female&lt;/label&gt;
    &lt;/div&gt;
    &lt;div class="form-item form-type-radio form-item-field-geslacht-und"&gt;
        &lt;input type="radio" id="edit-field-geslacht-und-male" name="field_geslacht[und]" value="male" checked="checked" class="form-radio"&gt;  
        &lt;label class="option" for="edit-field-geslacht-und-male"&gt;Male&lt;/label&gt;
    &lt;/div&gt;
    &lt;div class="form-item form-type-radio form-item-field-geslacht-und"&gt;
        &lt;input type="radio" id="edit-field-geslacht-und-other" name="field_geslacht[und]" value="other" class="form-radio"&gt;  
        &lt;label class="option" for="edit-field-geslacht-und-other"&gt;Other (transgender...)&lt;/label&gt;
    &lt;/div&gt;
&lt;/div&gt;


Now I would like to add the following html before every radio input:

&lt;span class="radio" style="background-position: 0px -28px;"&gt;&lt;/span&gt;


But how can I do this?

UPDATE:

I've tried to do it with theme_form_element function and now have this:

function theme_form_element($variables)
{
    if($variables['element']['#type'] == 'radio')
    {
        dump($variables);
    }
}


My dump shows me this array:

array (size=1)
  'element' =&gt; 
    array (size=27)
      '#type' =&gt; string 'radio' (length=5)
      '#title' =&gt; string 'Female' (length=6)
      '#return_value' =&gt; string 'female' (length=6)
      '#default_value' =&gt; string 'male' (length=4)
      '#attributes' =&gt; 
        array (size=0)
          empty
      '#parents' =&gt; 
        array (size=2)
          0 =&gt; string 'field_geslacht' (length=14)
          1 =&gt; string 'und' (length=3)
      '#id' =&gt; string 'edit-field-geslacht-und-female' (length=30)
      '#ajax' =&gt; null
      '#weight' =&gt; float 0.001
      '#input' =&gt; boolean true
      '#process' =&gt; 
        array (size=1)
          0 =&gt; string 'ajax_process_form' (length=17)
      '#theme' =&gt; string 'radio' (length=5)
      '#theme_wrappers' =&gt; 
        array (size=1)
          0 =&gt; string 'form_element' (length=12)
      '#title_display' =&gt; string 'after' (length=5)
      '#pre_render' =&gt; 
        array (size=1)
          0 =&gt; string 'ctools_dependent_pre_render' (length=27)
      '#after_build' =&gt; 
        array (size=1)
          0 =&gt; string 'conditional_fields_element_after_build' (length=38)
      '#defaults_loaded' =&gt; boolean true
      '#tree' =&gt; boolean true
      '#array_parents' =&gt; 
        array (size=3)
          0 =&gt; string 'field_geslacht' (length=14)
          1 =&gt; string 'und' (length=3)
          2 =&gt; string 'female' (length=6)
      '#processed' =&gt; boolean true
      '#required' =&gt; boolean false
      '#name' =&gt; string 'field_geslacht[und]' (length=19)
      '#value' =&gt; string 'male' (length=4)
      '#ajax_processed' =&gt; boolean false
      '#sorted' =&gt; boolean true
      '#after_build_done' =&gt; boolean true
      '#children' =&gt; string '&lt;input type="radio" id="edit-field-geslacht-und-female" name="field_geslacht[und]" value="female" class="form-radio" /&gt;' (length=119)


I've tried to change the #children variable and add my html before it. But when I do that no element on my page is showing ... .
You can override the theme_radio function in your own theme :

function mytheme_radio($variables) {
  $element = $variables['element'];
  $element['#attributes']['type'] = 'radio';
  element_set_attributes($element, array('id', 'name','#return_value' =&gt; 'value'));

  if (isset($element['#return_value']) &amp;&amp; $element['#value'] !== FALSE &amp;&amp; $element['#value'] == $element['#return_value']) {
    $element['#attributes']['checked'] = 'checked';
  }
  _form_set_class($element, array('form-radio'));

  if ($its_my_field) {
     return '&lt;span class="radio" style="background-position: 0px -28px;"&gt;&lt;/span&gt;&lt;input' . drupal_attributes($element['#attributes']) . ' /&gt;';
  }
  else {
     return '&lt;/span&gt;&lt;input' . drupal_attributes($element['#attributes']) . ' /&gt;';
  }


Maybe try with the more generic function theme_form_element.

Make sure to add conditions to only affect the form or the element you need like in the example written above.