The actual error happens here in the taxonomy module
switch ($display['type']) {
case 'taxonomy_term_reference_link':
foreach ($items as $delta => $item) {
if ($item['tid'] == 'autocreate') {
$element[$delta] = array(
'#markup' => check_plain($item['name']),
);
}
else {
$term = $item['taxonomy_term'];
$uri = entity_uri('taxonomy_term', $term);
$element[$delta] = array(
'#type' => 'link',
'#title' => $term->name,
'#href' => $uri['path'],
'#options' => $uri['options'],
);
}
}
break;
....
}
Which is triggered by this code in the node module.
$nodes = array($node->nid => $node);
field_attach_prepare_view('node', $nodes, 'full');
How to reproduce.
Steps
1. Create a vanilla Drupal installation.
2. Add a term reference field and set the display mode to "Link" (taxonomy_term_reference_link) and make it be displayable in teaser/full display
3. Start creating a node, and add a term in the term reference field.
4. Press "Preview" on the node form.
(The error also happens on node already created and being previewed in edit mode)
Actual result
The "fatal error page" is displayed.
Expected result
The node preview is displayed above the node form.
Comments
Comment #1
googletorp commentedWhen actually viewing a node
Is used instead, I tried using this code instead and it stops the site from crashing when previewing the node, and everything seems to be working just fine.
Comment #2
googletorp commentedAdds how to reproduce error description in bug report.
Comment #3
googletorp commentedFixed a stupid c/p flaw in the previous patch.
Comment #5
jazzdrive3 commentedRe-rolled patch.
Confirming googletorp's diagnosis. Without a node_build_content(), the $item in taxonomy_field_formatter_view() never gets its 'taxonomy_term' index populated, which is what is eventually passed to entity_uri().
Comment #6
jazzdrive3 commented