function prevnext_node_view in Prevnext 7
Same name and namespace in other branches
- 8 prevnext.module \prevnext_node_view()
- 2.x prevnext.module \prevnext_node_view()
- 2.0.x prevnext.module \prevnext_node_view()
Implements hook_node_view().
File
- ./
prevnext.module, line 43 - prevnext.module
Code
function prevnext_node_view($node, $view_mode, $langcode) {
$enabled_nodetypes = array_filter(variable_get('prevnext_enabled_nodetypes', array()));
if (in_array($node->type, $enabled_nodetypes)) {
$extrafields = field_extra_fields_get_display('node', $node->type, $view_mode);
$language = NULL;
if (module_exists('i18n_node')) {
$mode = variable_get('language_content_type_' . $node->type, 0);
$language = $mode != 0 ? $langcode : NULL;
}
$prevnext = _prevnext_get_prevnext($node, $language);
// @todo: Change theme() with a renderable array.
if (isset($extrafields['prevnext_previous']) && !empty($extrafields['prevnext_previous']['visible']) && !empty($prevnext['prev'])) {
$node->content['prevnext_previous'] = array(
'#markup' => theme('prevnext_previous', array(
'previous' => 'node/' . $prevnext['prev'],
)),
);
}
if (isset($extrafields['prevnext_next']) && !empty($extrafields['prevnext_next']['visible']) && !empty($prevnext['next'])) {
$node->content['prevnext_next'] = array(
'#markup' => theme('prevnext_next', array(
'next' => 'node/' . $prevnext['next'],
)),
);
}
}
}