You are here

function pagination_link in Pagination (Node) 6

@desc Implementation of hook_link()

File

./pagination.module, line 409
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_link($type, $object, $teaser = false) {
  $pg =& Pagination::getInstance();
  $type = isset($object->type) ? $object->type : '';
  $paging = $pg
    ->getValue($type);
  $count = $pg
    ->getPageCount();
  $page = $pg
    ->getPageVar();
  $showfull = variable_get('pagination_showall', 1);
  if (!$teaser and $paging and ($count > 1 or $page === 'show') and $showfull and $object->build_mode != NODE_BUILD_PRINT) {
    $query = $page !== 'show' ? 'page=show' : null;
    $title = $page !== 'show' ? t('Show full page') : t('Show paged');
    $class = $page !== 'show' ? 'pagination-show-full-page' : 'pagination-show-paged';
    $links['pagination-showall'] = array(
      'title' => $title,
      'href' => isset($object->path) ? $object->path : 'node/' . $object->nid,
      'query' => $query,
      'attributes' => array(
        'title' => $title,
        'class' => $class,
      ),
    );
    return $links;
  }
}