function pagination_preprocess_node in Pagination (Node) 6
Same name and namespace in other branches
- 7 pagination.module \pagination_preprocess_node()
@desc Implementation of template_preprocess_node()
File
- ./
pagination.module, line 339 - 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_preprocess_node(&$variables) {
// Provides additional template variables for theme developers to play with.
if (false == $variables['teaser']) {
$pg =& Pagination::getInstance();
$paginate = $pg
->getValue($variables['type']);
if ($paginate) {
$variables['pager'] = $pg
->getPager();
}
if ($paginate || variable_get('pagination_filter', 1)) {
$headers = $pg
->getHeaders($variables['node']->nid);
$page = $pg
->getPageVar();
if ($page == 0 || $page == 'show' || !isset($headers[$page])) {
$title = drupal_get_title();
}
else {
$title = $headers[$page];
}
$variables['content'] = preg_replace($pg->re_custom, '', $variables['content']);
$variables['pagination'] = (object) array(
'page_header' => $title,
'page_number' => $page,
);
}
}
}