You are here

function recently_read_block_view in Recently Read 7

Same name and namespace in other branches
  1. 7.2 recently_read.module \recently_read_block_view()

Implements hook_block_view().

File

./recently_read.module, line 97
Recently read module file. Displays a history of recently read nodes by currently logged in user.

Code

function recently_read_block_view($delta) {

  // disable caching of entire page if recently read block is being displayed
  recently_read_disable_page_cache();

  // view block containing links to recently visited nodes
  global $user;
  $max_entries = variable_get('recently_read_max_entries', 10);
  $max_count = variable_get('recently_read_max_length', array(
    'page' => 10,
    'story' => 10,
  ));
  isset($max_count[$delta]) ? $limit = $max_count[$delta] : ($limit = $max_entries);
  $items = recently_read_get_read_items(array(
    $delta,
  ), $user->uid, $limit);
  $types = node_type_get_types();
  return array(
    'subject' => t('Recently read - @type', array(
      '@type' => $types[$delta]->name,
    )),
    'content' => theme('recently_read_item_list', array(
      'items' => $items,
    )),
  );
}