You are here

function webfm_link in Web File Manager 5

Same name and namespace in other branches
  1. 5.2 webfm.module \webfm_link()

Implementation of hook_link().

File

./webfm.module, line 149

Code

function webfm_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();

  // Display a link with the number of attachments
  if ($teaser && $type == 'node' && isset($node->webfm_files) && user_access('view webfm attachments')) {
    if ($num_files = count($node->webfm_files)) {
      $links['webfm_attachments'] = array(
        'title' => format_plural($num_files, '1 attachment', '@count attachments'),
        'href' => "node/{$node->nid}",
        'attributes' => array(
          'title' => t('Read full article to view attachments.'),
        ),
        'fragment' => 'attachments',
      );
    }
  }
  return $links;
}