function views_term_hierarchy_sort::post_execute in Views term hierarchy 7
Run after the view is executed, before the result is cached.
This gives all the handlers some time to modify values. This is primarily used so that handlers that pull up secondary data can put it in the $values so that the raw data can be utilized externally.
Overrides views_handler::post_execute
File
- views/
views_term_hierarchy_sort.inc, line 16
Class
Code
function post_execute(&$values) {
$vocabularies = array();
foreach ($values as $value) {
if (isset($value->taxonomy_vocabulary_machine_name)) {
$vocabulary = $value->taxonomy_vocabulary_machine_name;
if (!isset($vocabularies[$vocabulary])) {
$vocabularies[$vocabulary] = $vocabulary;
}
}
}
if (empty($vocabularies)) {
return;
}
$term_trees = array();
$this->term_weights = array();
$vocabularies_by_name = taxonomy_vocabulary_get_names();
foreach ($vocabularies as $vocabulary) {
$term_trees[$vocabulary] = taxonomy_get_tree($vocabularies_by_name[$vocabulary]->vid);
foreach ($term_trees[$vocabulary] as $weight => $term) {
$this->term_weights[$term->tid] = $weight;
}
}
usort($values, array(
$this,
'hierarchy_sort_cmp',
));
}