blog_block_view

Versions
mediamosa-21
blog_block_view($delta = '')

Implements hook_block_view().

Displays the most recent 10 blog titles.

Code

modules/blog/blog.module, line 214

<?php
function blog_block_view($delta = '') {
  global $user;

  if (user_access('access content')) {
    $result = db_select('node', 'n')
      ->fields('n', array('nid', 'title', 'created'))
      ->condition('type', 'blog')
      ->condition('status', 1)
      ->orderBy('created', 'DESC')
      ->range(0, variable_get('blog_block_count', 10))
      ->addTag('node_access')
      ->execute();

    if ($node_title_list = node_title_list($result)) {
      $block['content'] = $node_title_list;
      $block['content'] .= theme('more_link', array('url' => url('blog'), 'title' => t('Read the latest blog entries.')));
      $block['subject'] = t('Recent blog posts');
      return $block;
    }
  }
}
?>