1. Terms are ordered alphabetically instead of term weight.
2. Though there is a dash, "-", in front of child terms, hierarchy is broken since alpha ordering overrides hierarchy.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AaronBauman’s picture

Title: Widget does not respect term hierarchy or weights » Dash to delimit term hierarchy does not appear consistently

Sorry, I was mis-reading this bug.
It seems that the weights and hierarchy are respected, but the dash, "-", is added inconsistently, making it appear as if the terms are mis-ordered.

AaronBauman’s picture

Title: Dash to delimit term hierarchy does not appear consistently » Dashes to delimit term hierarchy does not appear for term values with html special chars (& < >)
FileSize
1.12 KB

This issue is limited to term values whose names contain html special chars.

The specific cause of this issue is this line of profile_taxonomy_field_widget(), around line number 278:

// encode html special char and whitespace for correct matching of array values
array_walk($reference->terms['values'], '_profile_taxonomy_check_html_special_chars'); 

1. The encoding callback is invoked on every iteration of a loop, which means that values are encoded once for every option. This means we end up with values like &amp;amp;amp;amp;amp;amp;amp;...
2. It's not even necessary to call it once, since none of the term values for which we're searching are encoded in the first place.
3. Since this is the only place where _profile_taxonomy_check_html_special_chars() is called, the function itself is now superfluous.

Attached patch addresses these concerns.

AaronBauman’s picture

Status: Active » Needs review
gnindl’s picture

Status: Needs review » Fixed

Thanks aaronbauman, as this is a quite obvious patch which shouldn't have any side effect, it has been committed to repository:
http://drupalcode.org/project/profile_taxonomy.git/blobdiff/1e9596e285d8...

Status: Fixed » Closed (fixed)

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