Customizing the form for a field in the content edit form I have configured a taxonomy as field of a content type, but I want to replace the checkbox label (work with iphone) with the image field of that taxonomy. (See the screenshot.)



I only know to alter node.pages.inc at row 290 by adding the following code.

$form['product_label'] = array(
    '#type' =&gt; 'checkboxes',
    '#title' =&gt; 'Checkboxes Title',
    '#title_display' =&gt; 'before',
    '#default_value' =&gt; array(0,2),
    '#options' =&gt; array(
      0 =&gt; 'option one',
      1 =&gt; 'option two',
      2 =&gt; 'option three', 
    ), 
    '#theme' =&gt; 'testmodule_checkboxes',
  );


product_label is the checkbox name. The above code is to override the current checkbox field. 

I think this not the best way. Can anyone provide any direction? What module can do it?

Here is the dump of the checkbox field of the form.

array(6) { ["#type"]=&gt; string(9) "container" ["#attributes"]=&gt; array(1) { ["class"]=&gt; array(3) { [0]=&gt; string(34) "field-type-taxonomy-term-reference" [1]=&gt; string(22) "field-name-field-icon1" [2]=&gt; string(28) "field-widget-options-buttons" } } ["#weight"]=&gt; string(1) "2" ["#tree"]=&gt; bool(true) ["#language"]=&gt; string(3) "und" ["und"]=&gt; array(18) { ["#entity"]=&gt; object(stdClass)#91 (12) { ["uid"]=&gt; string(1) "1" ["name"]=&gt; string(5) "admin" ["type"]=&gt; string(7) "product" ["language"]=&gt; string(3) "und" ["title"]=&gt; NULL ["status"]=&gt; int(0) ["promote"]=&gt; int(0) ["sticky"]=&gt; int(0) ["created"]=&gt; int(1344929691) ["revision"]=&gt; bool(false) ["comment"]=&gt; string(1) "1" ["menu"]=&gt; array(12) { ["link_title"]=&gt; string(0) "" ["mlid"]=&gt; int(0) ["plid"]=&gt; int(0) ["menu_name"]=&gt; string(9) "main-menu" ["weight"]=&gt; int(0) ["options"]=&gt; array(0) { } ["module"]=&gt; string(4) "menu" ["expanded"]=&gt; int(0) ["hidden"]=&gt; int(0) ["has_children"]=&gt; int(0) ["customized"]=&gt; int(0) ["parent_depth_limit"]=&gt; int(8) } } ["#entity_type"]=&gt; string(4) "node" ["#bundle"]=&gt; string(7) "product" ["#field_name"]=&gt; string(11) "field_icon1" ["#language"]=&gt; string(3) "und" ["#field_parents"]=&gt; array(0) { } ["#columns"]=&gt; array(1) { [0]=&gt; string(3) "tid" } ["#title"]=&gt; string(4) "icon" ["#description"]=&gt; string(0) "" ["#required"]=&gt; bool(false) ["#delta"]=&gt; int(0) ["#type"]=&gt; string(10) "checkboxes" ["#default_value"]=&gt; array(0) { } ["#options"]=&gt; array(1) { [14]=&gt; string(16) "Work with iphone" } ["#value_key"]=&gt; string(3) "tid" ["#element_validate"]=&gt; array(1) { [0]=&gt; string(29) "options_field_widget_validate" } ["#properties"]=&gt; array(4) { ["filter_xss"]=&gt; bool(true) ["strip_tags"]=&gt; bool(false) ["empty_option"]=&gt; bool(false) ["optgroups"]=&gt; bool(false) } ["#after_build"]=&gt; array(1) { [0]=&gt; string(30) "field_form_element_after_build" } } }


The problem is that I can't find the image (filename) which is a custom field of the taxonomy. I want to replace "work with iphone" with the uploaded image. How can I do this?
first of all use hook_form_alter to alter any form. so in your custom module something like this

function CUSTOMMODULENAME_form_alter(&amp;$form, $form_state, $form_id){
   if ($form_id == 'FORM_ID'){
     --
   }