| 5 node.module | theme_node_preview($node) |
| 6 node.pages.inc | theme_node_preview( |
| 7 node.pages.inc | theme_node_preview($variables) |
| 8 node.pages.inc | theme_node_preview($variables) |
Returns HTML for a node preview for display during node creation and editing.
Parameters
$variables: An associative array containing:
- node: The node object which is being previewed.
Related topics
1 theme call to theme_node_preview()
File
- modules/
node/ node.pages.inc, line 375 - Page callbacks for adding, editing, deleting, and revisions management for content.
Code
function theme_node_preview($variables) {
$node = $variables['node'];
$output = '<div class="preview">';
$preview_trimmed_version = FALSE;
$elements = node_view(clone $node, 'teaser');
$trimmed = drupal_render($elements);
$elements = node_view($node, 'full');
$full = drupal_render($elements);
// Do we need to preview trimmed version of post as well as full version?
if ($trimmed != $full) {
drupal_set_message(t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication.<span class="no-js"> You can insert the delimiter "<!--break-->" (without the quotes) to fine-tune where your post gets split.</span>'));
$output .= '<h3>' . t('Preview trimmed version') . '</h3>';
$output .= $trimmed;
$output .= '<h3>' . t('Preview full version') . '</h3>';
$output .= $full;
}
else {
$output .= $full;
}
$output .= "</div>\n";
return $output;
}
Login or register to post comments
Comments
$preview_trimmed_version not used
I just noticed that the
$preview_trimmed_version = FALSE;line doesn't seem to be doing anything. It was used in the D6 version, so I'm guessing that it is just a line of legacy code that could now be removed.