I don't know if I'm missing something, but installing similar terms and placing the block in a node displayed with panels doesn't work. I haven't tested if it's related to panels but I don't think it is.
Anyways the problem is this code:
function similarterms_taxonomy_node_get_terms($node, $vid = NULL) {
$terms = &drupal_static(__FUNCTION__);
$fields = field_info_fields();
$story_vocabs = array();
foreach ($fields as $field_name => $field) {
if ($field['type'] == 'taxonomy_term_reference' && !empty($field['bundles']['node']) && in_array($node->type, $field['bundles']['node'])) {
$node_fields = field_get_items('node', $node, $field['field_name']);
foreach ($node_fields as $item) {
if (($vid == NULL) || ($item['taxonomy_term']->vid == $vid)) {
$terms[$node->vid]['tid'][$item['tid']] = $item['taxonomy_term'];
}
}
}
}
return $terms[$node->vid]['tid'];
}
The problem is that $item is an array only having the tid key of the term referenced. This is what I expected, so I'm not quite sure where 'taxonomy_term' should be coming from.
A quick fix would be be to add:
foreach ($node_fields as $item) {
if (!isset($item['taxonomy_term']) && isset($item['tid'])) {
$item['taxonomy_term'] = taxonomy_term_load($item['tid']);
}
...
This seems to fix the problem for me, but something better should probably be made instead.
Comments
Comment #1
googletorp commentedThe actual change as a patch
Comment #2
takim commented