summaryrefslogtreecommitdiff
path: root/modules/node
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-12-27 17:21:58 -0500
committerDavid Rothstein <drothstein@gmail.com>2013-12-27 17:21:58 -0500
commit1518a55a864b841c749f88f96c14a4191b8d543a (patch)
tree01abb562b02501d6aedc2c7ca722bc38a9aa0717 /modules/node
parenta009ee6786788d48fc9e2eccb60c3f3d100dbcc0 (diff)
downloadbrdo-1518a55a864b841c749f88f96c14a4191b8d543a.tar.gz
brdo-1518a55a864b841c749f88f96c14a4191b8d543a.tar.bz2
Revert "Issue #1289336 by jthorson, JimmyAx, marcingy, no_commit_credit, rooby | janipuni: Calling node_view for the same node with multiple view modes on the same page does not correctly attach fields."
This reverts commit 850c6e38cbf36047bf0bf597bc7e5767ab6989d5.
Diffstat (limited to 'modules/node')
-rw-r--r--modules/node/node.pages.inc1
-rw-r--r--modules/node/node.test77
2 files changed, 5 insertions, 73 deletions
diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc
index 3daf91d50..75ed0ddb8 100644
--- a/modules/node/node.pages.inc
+++ b/modules/node/node.pages.inc
@@ -393,6 +393,7 @@ function node_preview($node) {
$node->changed = REQUEST_TIME;
$nodes = array($node->nid => $node);
+ field_attach_prepare_view('node', $nodes, 'full');
// Display a preview of the node.
if (!form_get_errors()) {
diff --git a/modules/node/node.test b/modules/node/node.test
index fd66216c1..b1d78fa1d 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -457,70 +457,10 @@ class PagePreviewTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp(array('taxonomy', 'node'));
+ parent::setUp();
$web_user = $this->drupalCreateUser(array('edit own page content', 'create page content'));
$this->drupalLogin($web_user);
-
- // Add a vocabulary so we can test different view modes.
- $vocabulary = (object) array(
- 'name' => $this->randomName(),
- 'description' => $this->randomName(),
- 'machine_name' => drupal_strtolower($this->randomName()),
- 'help' => '',
- 'nodes' => array('page' => 'page'),
- );
- taxonomy_vocabulary_save($vocabulary);
-
- $this->vocabulary = $vocabulary;
-
- // Add a term to the vocabulary.
- $term = (object) array(
- 'name' => $this->randomName(),
- 'description' => $this->randomName(),
- // Use the first available text format.
- 'format' => db_query_range('SELECT format FROM {filter_format}', 0, 1)->fetchField(),
- 'vid' => $this->vocabulary->vid,
- 'vocabulary_machine_name' => $vocabulary->machine_name,
- );
- taxonomy_term_save($term);
-
- $this->term = $term;
-
- // Set up a field and instance.
- $this->field_name = drupal_strtolower($this->randomName());
- $this->field = array(
- 'field_name' => $this->field_name,
- 'type' => 'taxonomy_term_reference',
- 'settings' => array(
- 'allowed_values' => array(
- array(
- 'vocabulary' => $this->vocabulary->machine_name,
- 'parent' => '0',
- ),
- ),
- )
- );
-
- field_create_field($this->field);
- $this->instance = array(
- 'field_name' => $this->field_name,
- 'entity_type' => 'node',
- 'bundle' => 'page',
- 'widget' => array(
- 'type' => 'options_select',
- ),
- // Hide on full display but render on teaser.
- 'display' => array(
- 'default' => array(
- 'type' => 'hidden',
- ),
- 'teaser' => array(
- 'type' => 'taxonomy_term_reference_link',
- ),
- ),
- );
- field_create_instance($this->instance);
}
/**
@@ -530,26 +470,21 @@ class PagePreviewTestCase extends DrupalWebTestCase {
$langcode = LANGUAGE_NONE;
$title_key = "title";
$body_key = "body[$langcode][0][value]";
- $term_key = "{$this->field_name}[$langcode]";
// Fill in node creation form and preview node.
$edit = array();
$edit[$title_key] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16);
- $edit[$term_key] = $this->term->tid;
$this->drupalPost('node/add/page', $edit, t('Preview'));
- // Check that the preview is displaying the title, body, and term.
+ // Check that the preview is displaying the title and body.
$this->assertTitle(t('Preview | Drupal'), 'Basic page title is preview.');
$this->assertText($edit[$title_key], 'Title displayed.');
$this->assertText($edit[$body_key], 'Body displayed.');
- $this->assertText($edit[$term_key], 'Term displayed.');
- // Check that the title and body fields are displayed with the
- // correct values.
+ // Check that the title and body fields are displayed with the correct values.
$this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
$this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
- $this->assertFieldByName($term_key, $edit[$term_key], 'Term field displayed.');
}
/**
@@ -559,7 +494,6 @@ class PagePreviewTestCase extends DrupalWebTestCase {
$langcode = LANGUAGE_NONE;
$title_key = "title";
$body_key = "body[$langcode][0][value]";
- $term_key = "{$this->field_name}[$langcode]";
// Force revision on "Basic page" content.
variable_set('node_options_page', array('status', 'revision'));
@@ -567,20 +501,17 @@ class PagePreviewTestCase extends DrupalWebTestCase {
$edit = array();
$edit[$title_key] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16);
- $edit[$term_key] = $this->term->tid;
$edit['log'] = $this->randomName(32);
$this->drupalPost('node/add/page', $edit, t('Preview'));
- // Check that the preview is displaying the title, body, and term.
+ // Check that the preview is displaying the title and body.
$this->assertTitle(t('Preview | Drupal'), 'Basic page title is preview.');
$this->assertText($edit[$title_key], 'Title displayed.');
$this->assertText($edit[$body_key], 'Body displayed.');
- $this->assertText($edit[$term_key], 'Term displayed.');
// Check that the title and body fields are displayed with the correct values.
$this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
$this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
- $this->assertFieldByName($term_key, $edit[$term_key], 'Term field displayed.');
// Check that the log field has the correct value.
$this->assertFieldByName('log', $edit['log'], 'Log field displayed.');