I've got special tagging needs so I've added a hook so extension modules can remove vocabularies that they do special processing on. Is this something worth considering as a change to the module? The hook returns the tags it added and the updated list of vocabularies.

function autotag_search_form_part($text, $content_type){
...
$vids = _autotag_get_vids_for_type($content_type);
// BEGIN CHANGE

// module_invoke_all doesn't support reference params and we need $vids and $terms as ref params,
// so need to call hook_process_vocabularies directly instead of:
// module_invoke_all('process_vocabularies', $text,$vids,$terms);
// See reference comment at: http://api.drupal.org/api/function/module_invoke_all/6
$hook = 'process_vocabularies';
foreach (module_implements($hook) as $module) {
$function = $module . '_' . $hook;
$function($text,$vids,$terms);
}
//END CHANGE
/**
* Discovered that the following only seems to work in PHP 5.2, FARP!
* Thanks to
* http://stackoverflow.com/questions/790596/split-a-text-into-single-words
* $words_including_small = preg_split('/[\p{P}\s\{\}\[\]\(\)]/', strtolower($text), -1, PREG_SPLIT_NO_EMPTY);
*/
$words_including_small = preg_split('/[\ `!"£$%^&*()_\-+={\[}\]:;@\'~#<,>.?\/|\\\]/', strtolower($text), -1, PREG_SPLIT_NO_EMPTY);
...
}

Comments

sdrycroft’s picture

Version: 6.x-2.0 » 7.x-3.0
Issue summary: View changes
Status: Active » Fixed

I'm not sure whether the 7.x version of the module could make use of either of these hooks. I suspect that an additional module that implements the same Tag API hook as the Autotag module may be the best way of solving this problem.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.