summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2005-02-27 02:54:24 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2005-02-27 02:54:24 +0000
commit538a3071dedb294cae38f79777cb56865beafa8f (patch)
tree136d80962c861269775a6198ef379d3c412ce588 /modules
parentd4f1b435a11b1ea3264e38f78fcdbe6905060d5f (diff)
downloadbrdo-538a3071dedb294cae38f79777cb56865beafa8f.tar.gz
brdo-538a3071dedb294cae38f79777cb56865beafa8f.tar.bz2
- #17870: Add preview CSS class to node preview (drumm)
Diffstat (limited to 'modules')
-rw-r--r--modules/node.module37
-rw-r--r--modules/node/node.module37
2 files changed, 50 insertions, 24 deletions
diff --git a/modules/node.module b/modules/node.module
index 096d194a6..6deb1d2d3 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -1489,19 +1489,9 @@ function node_preview($node) {
$node->teaser = node_teaser($node->body);
}
- // Previewing alters $node so it needs to be cloned.
- $edit = clone($node);
// Display a preview of the node:
- if ($node->teaser && $node->teaser != $node->body) {
- $output = '<h3>'. t('Preview trimmed version') .'</h3>';
- $output .= node_view($edit, 1, FALSE, 0);
- $output .= '<p><em>'. t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "&lt;!--break--&gt;" (without the quotes) to fine-tune where your post gets split.') .'</em></p>';
- $output .= '<h3>'. t('Preview full version') .'</h3>';
- $output .= node_view($edit, 0, FALSE, 0);
- }
- else {
- $output .= node_view($edit, 0, FALSE, 0);
- }
+ // Previewing alters $node so it needs to be cloned.
+ $output = theme('node_preview', clone($node));
$output .= node_form($node);
@@ -1513,6 +1503,29 @@ function node_preview($node) {
}
/**
+ * Display a node preview for display during node creation and editing.
+ *
+ * @param $node
+ * The node object which is being previewed.
+ */
+function theme_node_preview($node) {
+ $output = '<div class="preview">';
+ if ($node->teaser && $node->teaser != $node->body) {
+ $output .= '<h3>'. t('Preview trimmed version') .'</h3>';
+ $output .= node_view($node, 1, FALSE, 0);
+ $output .= '<p><em>'. t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "&lt;!--break--&gt;" (without the quotes) to fine-tune where your post gets split.') .'</em></p>';
+ $output .= '<h3>'. t('Preview full version') .'</h3>';
+ $output .= node_view($node, 0, FALSE, 0);
+ }
+ else {
+ $output .= node_view($node, 0, FALSE, 0);
+ }
+ $output .= "</div>\n";
+
+ return $output;
+}
+
+/**
* Accepts a submission of new or changed node content.
*
* @param $node
diff --git a/modules/node/node.module b/modules/node/node.module
index 096d194a6..6deb1d2d3 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1489,19 +1489,9 @@ function node_preview($node) {
$node->teaser = node_teaser($node->body);
}
- // Previewing alters $node so it needs to be cloned.
- $edit = clone($node);
// Display a preview of the node:
- if ($node->teaser && $node->teaser != $node->body) {
- $output = '<h3>'. t('Preview trimmed version') .'</h3>';
- $output .= node_view($edit, 1, FALSE, 0);
- $output .= '<p><em>'. t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "&lt;!--break--&gt;" (without the quotes) to fine-tune where your post gets split.') .'</em></p>';
- $output .= '<h3>'. t('Preview full version') .'</h3>';
- $output .= node_view($edit, 0, FALSE, 0);
- }
- else {
- $output .= node_view($edit, 0, FALSE, 0);
- }
+ // Previewing alters $node so it needs to be cloned.
+ $output = theme('node_preview', clone($node));
$output .= node_form($node);
@@ -1513,6 +1503,29 @@ function node_preview($node) {
}
/**
+ * Display a node preview for display during node creation and editing.
+ *
+ * @param $node
+ * The node object which is being previewed.
+ */
+function theme_node_preview($node) {
+ $output = '<div class="preview">';
+ if ($node->teaser && $node->teaser != $node->body) {
+ $output .= '<h3>'. t('Preview trimmed version') .'</h3>';
+ $output .= node_view($node, 1, FALSE, 0);
+ $output .= '<p><em>'. t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "&lt;!--break--&gt;" (without the quotes) to fine-tune where your post gets split.') .'</em></p>';
+ $output .= '<h3>'. t('Preview full version') .'</h3>';
+ $output .= node_view($node, 0, FALSE, 0);
+ }
+ else {
+ $output .= node_view($node, 0, FALSE, 0);
+ }
+ $output .= "</div>\n";
+
+ return $output;
+}
+
+/**
* Accepts a submission of new or changed node content.
*
* @param $node