function blog_node_view

Implements hook_node_view().

File

drupal/modules/blog/blog.module, line 80
Enables multi-user blogs.

Code

function blog_node_view($node, $view_mode) {
  if ($view_mode != 'rss') {
    if ($node->type == 'blog' && (arg(0) != 'blog' || arg(1) != $node->uid)) {

      // This goes to l(), which escapes !username in both title and attributes.
      $links['blog_usernames_blog'] = array(
        'title' => t("!username's blog", array(
          '!username' => format_username($node),
        )),
        'href' => "blog/{$node->uid}",
        'attributes' => array(
          'title' => t("Read !username's latest blog entries.", array(
            '!username' => format_username($node),
          )),
        ),
      );
      $node->content['links']['blog'] = array(
        '#theme' => 'links__node__blog',
        '#links' => $links,
        '#attributes' => array(
          'class' => array(
            'links',
            'inline',
          ),
        ),
      );
    }
  }
}