You are here

function template_preprocess_node_gallery_api_item_navigator in Node Gallery 7

Preprocess function for theme_node_gallery_api_item_navigator().

File

theme/theme.inc, line 177
Node gallery theme functions

Code

function template_preprocess_node_gallery_api_item_navigator(&$variables) {
  drupal_add_css(drupal_get_path('module', 'node_gallery_api') . '/node_gallery_api.css');
  $relationship_type = node_gallery_api_get_relationship_type(NULL, $variables['item']->type);
  $fragment = FALSE;
  if ($relationship_type->settings['item_view']['page_fragment']) {
    $fragment = TRUE;
  }
  $entries = array();
  if (isset($variables['navigator']['prev_nid'])) {
    $entries = array_merge($entries, array(
      'prev',
      'first',
    ));
  }
  if (isset($variables['navigator']['next_nid'])) {
    $entries = array_merge($entries, array(
      'next',
      'last',
    ));
  }
  foreach ($entries as $type) {
    $nid = $variables['navigator'][$type . '_nid'];
    $variables[$type . '_link'] = $fragment ? url('node/' . $nid, array(
      'fragment' => 'node-' . $nid,
    )) : url('node/' . $nid);
  }
  if (!empty($variables['navigator']['gallery_nid'])) {
    $variables['gallery_link'] = url('node/' . $variables['navigator']['gallery_nid']);
    $gallery = node_load($variables['navigator']['gallery_nid']);
    $variables['gallery_title'] = check_plain($gallery->title);
  }
}