Sorting not applied

ednique - August 15, 2007 - 13:42
Project:Content Taxonomy
Version:4.7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:ednique
Status:patch (code needs review)
Description

When you have multiple terms in one single field, the weight field is taken into consideration. If all weights are the same, sorting should be by name...
I have created some piece of code...
in content_taxonomy_field_formatter()
just after

if (!is_array($item)) {
    return '';
  }

and before

if ($field['terms_as_links'] || $formatter == 'link') {

Place this sorting code:

  foreach ($item as $key => $row) {
    $weight[$key]  = $row->weight;
    $name[$key] = $row->name;
  }
  array_multisort($weight, SORT_ASC, $name, SORT_ASC, $item);

 
 

Drupal is a registered trademark of Dries Buytaert.