function nopremium_alter_node in Node Option Premium 6
Same name and namespace in other branches
- 7 nopremium.module \nopremium_alter_node()
Alter a node replacing full body by nopremium body.
1 call to nopremium_alter_node()
- nopremium_nodeapi in ./
nopremium.module - Implementation of hook_nodeapi().
File
- ./
nopremium.module, line 283 - Written by Henri MEDOT <henri.medot[AT]absyx[DOT]fr> http://www.absyx.fr
Code
function nopremium_alter_node($node, $page) {
$links = isset($node->links);
$node = node_load($node->nid);
$node = node_build_content($node, TRUE, $page);
$node->readmore = FALSE;
if ($links) {
$node->links = module_invoke_all('link', 'node', $node, TRUE);
drupal_alter('link', $node->links, $node);
}
$content = drupal_render($node->content);
$node->teaser = $content;
unset($node->body);
node_invoke_nodeapi($node, 'alter', TRUE, $page);
if (nopremium_check_content_extra_field()) {
$node->body = $node->teaser;
}
else {
$node->nopremium_message = theme('nopremium_message', $node);
$node->body = theme('nopremium_body', $node);
}
unset($node->teaser);
return $node;
}