You are here

function pagination_block_view in Pagination (Node) 7

Implementation of hook_block_view().

File

./pagination.module, line 148

Code

function pagination_block_view($delta = '') {
  if ($delta != 'toc' || drupal_is_front_page()) {
    return;
  }
  $block = NULL;
  $nid = arg(1);
  if (arg(0) == 'node' && is_numeric($nid)) {
    $pg = Pagination::instance();
    if ($pg
      ->getPageCount() > 1 && $pg
      ->getPageVar() !== 'show') {
      $block = array(
        'subject' => t('Table of Contents'),
        'content' => $pg
          ->getToc($nid, TRUE),
      );
    }
  }
  return $block;
}