You are here

protected function Pagination::getSettings in Pagination (Node) 7

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

Return pagination settings by content type.

Parameters

$setting: The pagination setting to return. [value | style].

$type: The node type.

Return value

An array of pagination settings for a specific node type.

2 calls to Pagination::getSettings()
Pagination::getStyle in includes/Pagination.inc
Return the pagination style currently being used.
Pagination::getValue in includes/Pagination.inc
Return the pagination value currently being used.

File

includes/Pagination.inc, line 251

Class

Pagination
Handles all the pagination logic

Code

protected function getSettings($setting, $type) {
  static $pagination = array();
  if (!isset($pagination[$type])) {
    $result = db_select('pagination', 'p')
      ->fields('p')
      ->condition('type', $type, '=')
      ->execute()
      ->fetchObject();
    $pagination[$type] = array(
      'style' => isset($result->style) ? $result->style : 0,
      'value' => isset($result->paginate) ? $result->paginate : 0,
    );
  }
  $result = isset($pagination[$type][$setting]) ? $pagination[$type][$setting] : 0;
  return $result;
}