I am developing a module and I would like to know how to add a field to a taxonomy term?
My section is named special
and I want to add terms in this section
I have this code:
function add($form,&$form_state) { $form['name'] = array( '#type' => 'textfield', '#title' => t('name'), '#required' => TRUE, ); $form['submit_button'] = array( '#type' => 'submit', '#value' => t('send'), ); $form['#submit'][] = 'special_add_submit'; return $form; } function special_add_submit ($form, &$form_state) { $instance = array( 'field_name' => 'nombre', 'entity_type' => 'taxonomy_term', // This is the vocabulary 'bundle' => 'special', 'label' => t('Relates to option'), 'description' => t('This is the description'), 'required' => true, 'widget' => array( 'type' => 'text_textfield', 'settings'=> array( 'max_width'=>80) ), ); field_create_instance($instance); }
How to do that?
i create a field named name
when i save that field i want to add the value to taxonomy term named special