You are here

function quotes_link in Quotes 5

Same name and namespace in other branches
  1. 6 quotes.module \quotes_link()

Implementation of hook_link().

File

./quotes.module, line 521

Code

function quotes_link($type, $node = NULL, $teaser = FALSE) {
  global $user;
  $links = array();
  if ($type == 'node' && $node->type == 'quotes' && !(arg(0) == 'quotes' && arg(1) == $node->uid)) {
    $name = $node->uid ? $node->name : variable_get('anonymous', t('Anonymous'));
    if (variable_get('quotes_showlink', TRUE)) {
      if ($node->uid != $user->uid) {
        $links['quotes_usernames_quotes'] = array(
          'title' => t("!name's quotes", array(
            '!name' => $name,
          )),
          'href' => "quotes/{$node->uid}",
          'attributes' => array(
            'title' => t("View !name's quotes.", array(
              '!name' => $name,
            )),
          ),
        );
      }
    }
    if (variable_get('quotes_edit_link', TRUE)) {
      if (user_access('edit own quotes') && $node->uid == $user->uid || user_access('administer quotes')) {
        $links['quotes_edit_link'] = array(
          'title' => t('Edit quote'),
          'href' => 'node/' . $node->nid . '/edit',
          'attributes' => array(
            'title' => t('Edit this quote'),
          ),
        );
      }
    }
  }
  return $links;
}