im trying to wrap form item with
I had success with hook_from_alter and #prefix #suffix that is wrapping whole element with div like this:
I used this hook:
function em_form_alter(&$form, &$form_state, $form_id){ if ($form_id == 'user_register_form') { $form['field_gender'][LANGUAGE_NONE]['#prefix'] = '<div class="custom-select">'; $form['field_gender'][LANGUAGE_NONE]['#sufix'] = '</div">'; } } And i got this.
<div class="custom-select"> <div class="form-item form-type-select form-item-field-gender-und"> <label for="edit-field-gender-und">Gender</label> <select id="edit-field-gender-und" name="field_gender[und]" class="form-select required"> <option value="_none">- Select a value -</option> <option value="1">Male</option> <option value="2">Female</option> </select> </div> But what i need to accomplish is this:
<div class="form-item form-type-select form-item-field-gender-und"> <label for="edit-field-gender-und">Gender</label> <div class="custom-select"> <select id="edit-field-gender-und" name="field_gender[und]" class="form-select required"> <option value="_none">- Select a value -</option> <option value="1">Male</option> <option value="2">Female</option> </select> </div> And i would like to have this on every select on whole website, so maybe hook_form_alter isn`t so good idea?