function taxonomy_field_diff_view_prepare in Diff 7.3
Diff field callback for preloading term entities.
File
- includes/
taxonomy.inc, line 11 - Implements pusdeo-hook hook_field_diff_view() for the Taxonomy module.
Code
function taxonomy_field_diff_view_prepare(&$old_items, &$new_items, $context) {
$tids = array();
foreach (array_merge_recursive($old_items, $new_items) as $info) {
$tids[$info['tid']] = $info['tid'];
}
$terms = taxonomy_term_load_multiple($tids);
foreach ($old_items as $delta => $info) {
$old_items[$delta]['term'] = isset($terms[$info['tid']]) ? $terms[$info['tid']] : NULL;
}
foreach ($new_items as $delta => $info) {
$new_items[$delta]['term'] = isset($terms[$info['tid']]) ? $terms[$info['tid']] : NULL;
}
}