Suggestions are sorted by weight. I want to present suggested tags sorted by name so I had to modify tagging.module file to comment line 240 :

// uasort($suggestions,'element_sort');

Is there another way by not modifying tagging module to achieve this goal ?

Comments

eugenmayer’s picture

Status: Active » Closed (fixed)

drupal_alter('tagging_suggestions', $suggestions);

You can use this alter hook which is called after the suggestions "compilation" to change the sorting.
( see https://github.com/EugenMayer/tagging/blob/master/tagging.module#232 )

Anonymous’s picture

Status: Closed (fixed) » Active

Maybe it's late and I don't understand anything in the module code but this do not work because uasort function is called after drupal_alter call.

eugenmayer’s picture

well iam sorry, your right. So there is currently now way to change sorting, but that might be changeable. Maybe just create a feature reqeust for an API which is called after all suggestions are collected. If a hook is implemented..it is expected that this hook deals with the sorting and usort wont be called.