diff options
author | David Rothstein <drothstein@gmail.com> | 2012-11-06 01:59:01 -0500 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2012-11-06 01:59:01 -0500 |
commit | 6e344fd49cdaf55a21f1ff16bb312dcc897fbb78 (patch) | |
tree | 6791c741a95e9ef9cc7acb03cb85d9403668fc1a /modules/node | |
parent | 6b11350d32b753a45f4814325bdcd8aafd163050 (diff) | |
download | brdo-6e344fd49cdaf55a21f1ff16bb312dcc897fbb78.tar.gz brdo-6e344fd49cdaf55a21f1ff16bb312dcc897fbb78.tar.bz2 |
Issue #1154382 followup by plach: Fixed several issues with the newly-added hook_entity_view_mode_alter().
Diffstat (limited to 'modules/node')
-rw-r--r-- | modules/node/node.module | 4 | ||||
-rw-r--r-- | modules/node/node.test | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/modules/node/node.module b/modules/node/node.module index f181b52bb..d86c74d2d 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1393,6 +1393,10 @@ function node_build_content($node, $view_mode = 'full', $langcode = NULL) { // Allow modules to make their own additions to the node. module_invoke_all('node_view', $node, $view_mode, $langcode); module_invoke_all('entity_view', $node, 'node', $view_mode, $langcode); + + // Make sure the current view mode is stored if no module has already + // populated the related key. + $node->content += array('#view_mode' => $view_mode); } /** diff --git a/modules/node/node.test b/modules/node/node.test index 9ef4c2586..34ffb05cb 100644 --- a/modules/node/node.test +++ b/modules/node/node.test @@ -2644,5 +2644,9 @@ class NodeEntityViewModeAlterTest extends NodeWebTestCase { $this->assertText('Extra data that should appear only in the teaser for the node.', 'Teaser text present'); // Make sure body text is not present. $this->assertNoText('Data that should appear only in the body for the node.', 'Body text not present'); + + // Test that the correct build mode has been set. + $build = node_view($node); + $this->assertEqual($build['#view_mode'], 'teaser', 'The view mode has correctly been set to teaser.'); } } |