node_view
modules/node/node.module, строка 725
- Версии
- 5 – 6
node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE)
Генерирует вывод ноды.
Параметры
$node
Массив или объект ноды.
$teaser
Whether to display the teaser only, as on the main page.
$page
Определяет, отображается ли сама страница ноды, или же нода выводится в другом месте.
$links
Показывать ли ссылки ноды. Ссылки не показываются при предпросмотре редактирования.
Возвращаемое значение
Темизированное HTML представление ноды.
Код
<?php
function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
$node = (object)$node;
$node = node_build_content($node, $teaser, $page);
if ($links) {
$node->links = module_invoke_all('link', 'node', $node, $teaser);
foreach (module_implements('link_alter') AS $module) {
$function = $module .'_link_alter';
$function($node, $node->links);
}
}
// Set the proper node part, then unset unused $node part so that a bad
// theme can not open a security hole.
$content = drupal_render($node->content);
if ($teaser) {
$node->teaser = $content;
unset($node->body);
}
else {
$node->body = $content;
unset($node->teaser);
}
// Allow modules to modify the fully-built node.
node_invoke_nodeapi($node, 'alter', $teaser, $page);
return theme('node', $node, $teaser, $page);
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии