function taxonomy_field_widget_form

cis7 taxonomy.module taxonomy_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element)
cle7 taxonomy.module taxonomy_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element)
elmsmedia7 taxonomy.module taxonomy_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element)
icor7 taxonomy.module taxonomy_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element)
meedjum_blog7 taxonomy.module taxonomy_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element)
mooc7 taxonomy.module taxonomy_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element)

Implements hook_field_widget_form().

File

modules/taxonomy/taxonomy.module, line 1721
Enables the organization of content into categories.

Code

function taxonomy_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  $tags = array();
  foreach ($items as $item) {
    $tags[$item['tid']] = isset($item['taxonomy_term']) ? $item['taxonomy_term'] : taxonomy_term_load($item['tid']);
  }

  $element += array(
    '#type' => 'textfield',
    '#default_value' => taxonomy_implode_tags($tags),
    '#autocomplete_path' => $instance['widget']['settings']['autocomplete_path'] . '/' . $field['field_name'],
    '#size' => $instance['widget']['settings']['size'],
    '#maxlength' => 1024,
    '#element_validate' => array('taxonomy_autocomplete_validate'),
  );

  return $element;
}