You are here

function photos_link in Album Photos 6.2

File

./photos.module, line 538

Code

function photos_link($type, $node = NULL, $teaser = FALSE) {
  global $user;
  $links = array();
  if (user_access('view photo') && ($node->subalbum['count'] || $node->album['count'])) {
    if ($node->type == 'photos') {
      $title = t('Album view');
      $type = 'album';
    }
    else {
      $title = t('Sub-Album view');
      $type = 'sub_album';
    }
    $title = $node->type == 'photos' ? t('Album view') : t('Sub-Album view');
    $count = !empty($node->subalbum['count']) ? $node->subalbum['count'] : $node->album['count'];
    $links['photos_album'] = array(
      'title' => $title,
      'href' => "photos/{$type}/{$node->nid}",
      'attributes' => array(
        'title' => t('A total of !count images', array(
          '!count' => $count,
        )),
      ),
    );
    if (variable_get('photos_slide', 0)) {
      $links['photos_slide'] = array(
        'title' => t('Slideshow'),
        'href' => "photos/{$type}/{$node->nid}/slide",
      );
    }
  }
  if ($type == 'comment' && $node->comment) {
    if (arg(0) != 'photos' && ($fid = db_result(db_query('SELECT fid FROM {x_vote} WHERE cid = %d', $node->cid)))) {
      $links['link_photo'] = array(
        'title' => t('View image'),
        'href' => 'photos/image/' . $fid,
        'fragment' => 'comment-' . $node->cid,
      );
    }
  }
  return $links;
}