theme_node_preview
modules/node/node.pages.inc, строка 418
- Версии
- 5 – 6
theme_node_preview($node)
Отображает предпросмотр ноды во время ее создания и редактирования.
Параметры
$node
Объект ноды, предпросмотр которой осуществляется.
Связанные темы
Код
<?php
function theme_node_preview($node) {
$output = '<div class="preview">';
$preview_trimmed_version = FALSE;
// Do we need to preview trimmed version of post as well as full version?
if (isset($node->teaser) && isset($node->body)) {
$teaser = trim($node->teaser);
$body = trim(str_replace('<!--break-->', '', $node->body));
// Preview trimmed version if teaser and body will appear different;
// also (edge case) if both teaser and body have been specified by the user
// and are actually the same.
if ($teaser != $body || ($body && strpos($node->body, '<!--break-->') === 0)) {
$preview_trimmed_version = TRUE;
}
}
if ($preview_trimmed_version) {
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 .= node_view(drupal_clone($node), 1, FALSE, 0);
$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;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии