You are here

function user_badges_view_entity in User Badges 7.4

View for /user-badge/<bid> page.

1 string reference to 'user_badges_view_entity'
user_badges_menu in ./user_badges.module
Implements hook_menu().

File

./user_badges.module, line 325
Hooks and other stuff related to user badge.

Code

function user_badges_view_entity($user_badge) {
  $name = $user_badge->name;
  drupal_set_title($name);
  $uri = entity_uri('user_badge', $user_badge);

  // Set the node path as the canonical URL to prevent duplicate content.
  drupal_add_html_head_link(array(
    'rel' => 'canonical',
    'href' => url($uri['path'], $uri['options']),
  ), TRUE);

  // Set the non-aliased path as a default shortlink.
  drupal_add_html_head_link(array(
    'rel' => 'shortlink',
    'href' => url($uri['path'], array_merge($uri['options'], array(
      'alias' => TRUE,
    ))),
  ), TRUE);
  return user_badges_show($user_badge);
}