*** suggestedterms.original/suggestedterms.module 2009-10-09 00:34:21.000000000 +0200 --- suggestedterms/suggestedterms.module 2009-11-09 00:14:33.000000000 +0100 *************** *** 140,145 **** --- 140,187 ---- $form['taxonomy']['tags'][$vid]['#description'] .= "
\n". $tag_description . ': ' . _suggestedterms_build_suggestions($vid, $sort_order, $display_what); } } + /* + * Added by Muscarinus - this adds compatibility with fupload module + */ + elseif ($form_id == 'fupload_list_images_imagefield') { + $path = drupal_get_path('module', 'suggestedterms'); + drupal_add_js($path . '/suggestedterms.js'); + $display_what = variable_get('suggestedterms_display_mode', SUGGESTEDTERMS_DISPLAY_ALL); + // Loop over form and search for individual image fieldsets (Each one is saved in $form array as image fid) + foreach ($form as $key => $image_form) { + // If $key is numeric, it means that it represents image fid + if (is_numeric($key)) { + // If multiple vocabularies, loop over each. + foreach ($image_form['taxonomy_' . $key]['tags'] as $vid => $thisindex) { + // If free-tagging taxonomy is true, add new links for each free-tag textfield. + $sort_order = variable_get('suggestedterms_sort_order', SUGGESTEDTERMS_SORT_NAME); + switch ($sort_order) { + case SUGGESTEDTERMS_SORT_POPULAR: + $tag_description = t('Most popular terms'); + break; + + case SUGGESTEDTERMS_SORT_RECENT: + $tag_description = t('Recently added'); + break; + + case SUGGESTEDTERMS_SORT_WEIGHT: + $tag_description = t('Terms by Weight'); + break; + + case SUGGESTEDTERMS_SORT_USED: + $tag_description = t('Recently Used'); + break; + + default: + $tag_description = t('Terms by name'); + break; + } + // Build the suggested terms and set in description tag. + $form[$key]['taxonomy_' . $key]['tags'][$vid]['#description'] .= "
\n". $tag_description . ': ' . _suggestedterms_build_suggestions($vid, $sort_order, $display_what); + } + } + } + } } /**