function _node_gallery_api_item_view in Node Gallery 7
Attaches the image navigator to the image node's content.
Parameters
object $node: A reference to the image node object.
string $view_mode: View module
1 call to _node_gallery_api_item_view()
- node_gallery_api_node_view in ./
node_gallery_api.module - Implements hook_node_view().
File
- ./
node_gallery_api.module, line 1078 - Node Gallery module.
Code
function _node_gallery_api_item_view(&$node, $view_mode) {
$extra_field_settings = field_extra_fields_get_display('node', $node->type, $view_mode);
$relationships = node_gallery_api_get_relationships(NULL, $node->nid);
// Take the first one for now. In the future, if we
// support more than one gallery for an item, we need
// a way to specify context.
if (!empty($relationships)) {
$relationship = array_shift($relationships);
}
if (!empty($relationship) && !empty($extra_field_settings['node_gallery_navigation']) && $extra_field_settings['node_gallery_navigation']['visible']) {
if (variable_get('node_gallery_api_keyboard_shortcuts', FALSE)) {
drupal_add_js(drupal_get_path('module', 'node_gallery') . '/js/ng_keyboard_shortcuts.js');
}
$node->content['node_gallery_navigation'] = array(
'#theme' => 'node_gallery_api_item_navigator',
'#label_display' => 'hidden',
'#access' => TRUE,
'#weight' => $extra_field_settings['node_gallery_navigation']['weight'],
'#navigator' => node_gallery_api_get_item_navigator($relationship->ngid, $node->nid),
'#item' => $node,
);
}
}