Alter Views sort by taxonomy weight

Submitted by christophe on Mon, 03/10/2016 - 19:10

The use case is that we want to sort a list of users by job title, where job title is a term reference to a dedicated vocabulary.
The sort is done by the job title term weight (defined via the vocabulary list).

I choosed to apply a custom sort function on a view, instead of a custom dynamic / entity query for two reasons :