You are here

function pagination_block in Pagination (Node) 6

@desc Implementation of hook_block()

File

./pagination.module, line 241
pagination.module @desc Allow for arbitrary nodes to be paginated. administrators can set which nodes they wish to paginate, and the length of content required to split a node into pages. Alternatively, content creators can set manual break points…

Code

function pagination_block($op = 'list', $delta = 0, $edit = []) {
  switch ($op) {
    case 'list':
      $blocks[] = array(
        'info' => t('Table of Contents - Pagination'),
      );
      return $blocks;
      break;
    case 'view':
      if (drupal_is_front_page()) {
        return;
      }
      $block = null;
      $nid = arg(1);
      if (arg(0) == 'node' and is_numeric($nid)) {
        $pg =& Pagination::getInstance();
        if ($pg
          ->getPageCount() > 1 and $pg
          ->getPageVar() !== 'show') {
          $block = array(
            'subject' => t('Table of Contents'),
            'content' => $pg
              ->getToc($nid, TRUE),
          );
        }
      }
      return $block;
      break;
  }
}