You are here

function fivestar_link in Fivestar 5

Same name and namespace in other branches
  1. 6.2 fivestar.module \fivestar_link()
  2. 6 fivestar.module \fivestar_link()

Implementation of hook_link().

Add a "rate" link to node teaser.

File

./fivestar.module, line 894
A simple n-star voting widget, usable in other forms.

Code

function fivestar_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();
  if ($type == "node" && $teaser) {
    if (variable_get('fivestar_position_teaser_' . $node->type, 'above') == "link") {
      $links['rate'] = array(
        'title' => t('Rate'),
        'href' => 'node/' . $node->nid,
        'fragment' => 'fivestar-form-node-' . $node->nid,
        'attributes' => array(
          'title' => t('Rate this @type', array(
            '@type' => node_get_types('name', $node->type),
          )),
        ),
      );
    }
  }
  return $links;
}