You are here

public function Pagination::getHeaders in Pagination (Node) 7

Same name and namespace in other branches
  1. 6 pagination.module \Pagination::getHeaders()

Return the page headers for a specific node.

Parameters

$nid: The node ID of the node to be queried.

Return value

An array of page headers.

1 call to Pagination::getHeaders()
Pagination::getToc in includes/Pagination.inc
Return a themed table of contents.

File

includes/Pagination.inc, line 103

Class

Pagination
Handles all the pagination logic

Code

public function getHeaders($nid = 0) {
  if (!$nid) {
    return array();
  }
  static $query;
  if (!$query && $this->value > PAGINATION_AUTO) {
    $result = db_select('node_pagination', 'n')
      ->fields('n', array(
      'headers',
    ))
      ->condition('nid', $nid, '=')
      ->execute()
      ->fetchObject();
    $headers = isset($result->headers) ? unserialize($result->headers) : array();
    foreach ($headers as $key => $header) {

      //  Page 1 is always the node title
      $this->headers[$key + 1] = $header;
    }
  }
  return $this->headers;
}