function nopremium_alter_node in Node Option Premium 7
Same name and namespace in other branches
- 6 nopremium.module \nopremium_alter_node()
Alter a node replacing full content by nopremium content.
1 call to nopremium_alter_node()
- nopremium_node_view_alter in ./
nopremium.module - Implementation of hook_node_view_alter().
File
- ./
nopremium.module, line 360 - Written by Henri MEDOT <henri.medot[AT]absyx[DOT]fr> http://www.absyx.fr
Code
function nopremium_alter_node(&$build) {
$view_mode = $build['#view_mode'];
if ($view_mode != 'teaser') {
$node = $build['#node'];
$langcode = $build['#language'];
node_build_content($node, 'teaser', $langcode);
unset($node->content['links']['node']['#links']['node-readmore']);
$build = $node->content;
unset($node->content);
$build += array(
'#theme' => 'node',
'#node' => $node,
'#view_mode' => 'teaser',
'#language' => $langcode,
);
if (!empty($node->nid) && !($view_mode == 'full' && node_is_page($node))) {
$build['#contextual_links']['node'] = array(
'node',
array(
$node->nid,
),
);
}
$type = 'node';
drupal_alter(array(
'node_view',
'entity_view',
), $build, $type);
// Override _field_extra_fields_pre_render().
if (isset($build['#pre_render'])) {
$key = array_search('_field_extra_fields_pre_render', $build['#pre_render']);
if ($key !== FALSE) {
$build['#pre_render'][$key] = '_nopremium_field_extra_fields_pre_render';
}
}
$build['#view_mode'] = $view_mode;
}
}