Commit 137011df authored by Dries's avatar Dries

- Patch #844388 by lotyrin, bjaspan, effulgentsia: taxonomy terms disappear...

- Patch #844388 by lotyrin, bjaspan, effulgentsia: taxonomy terms disappear from node preview if previewed more than once.
parent a63facc8
......@@ -1035,10 +1035,17 @@ function field_attach_delete_revision($entity_type, $entity) {
/**
* Prepare field data prior to display.
*
* This function must be called before field_attach_view(). It lets field
* types and formatters load additional data needed for display, and
* therefore accepts an array of entities to allow query optimisation when
* displaying lists of entities.
* This function lets field types and formatters load additional data
* needed for display that is not automatically loaded during
* field_attach_load(). It accepts an array of entities to allow query
* optimisation when displaying lists of entities.
*
* field_attach_prepare_view() and field_attach_view() are two halves
* of the same operation. It is safe to call
* field_attach_prepare_view() multiple times on the same entity
* before calling field_attach_view() on it, but calling any Field
* API operation on an entity between passing that entity to these two
* functions may yield incorrect results.
*
* @param $entity_type
* The type of $entities; e.g. 'node' or 'user'.
......@@ -1076,8 +1083,12 @@ function field_attach_prepare_view($entity_type, $entities, $view_mode) {
* Each field is displayed according to the display options specified in the
* $instance definition for the given $view_mode.
*
* The entity must have run through field_attach_prepare_view() beforehands.
* @see field_attach_prepare_view()
* field_attach_prepare_view() and field_attach_view() are two halves
* of the same operation. It is safe to call
* field_attach_prepare_view() multiple times on the same entity
* before calling field_attach_view() on it, but calling any Field
* API operation on an entity between passing that entity to these two
* functions may yield incorrect results.
*
* Sample structure:
* @code
......
......@@ -339,11 +339,10 @@ function node_preview($node) {
field_attach_prepare_view('node', $nodes, 'full');
// Display a preview of the node.
// Previewing alters $node so it needs to be cloned.
if (!form_get_errors()) {
$cloned_node = clone $node;
$cloned_node->in_preview = TRUE;
$output = theme('node_preview', array('node' => $cloned_node));
$node->in_preview = TRUE;
$output = theme('node_preview', array('node' => $node));
unset($node->in_preview);
}
drupal_set_title(t('Preview'), PASS_THROUGH);
......
......@@ -451,6 +451,12 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
$this->drupalGet('node/' . $node->nid);
$this->assertText($term2->name, t('Term is displayed when viewing the node.'));
//Preview the node
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Preview'));
$this->assertNoUniqueText($term2->name, t('Term is displayed when previewing the node.'));
$this->drupalPost(NULL, NULL, t('Preview'));
$this->assertNoUniqueText($term2->name, t('Term is displayed when previewing the node again.'));
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment