diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-09-09 23:18:30 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-09-09 23:18:30 +0000 |
commit | ccd6fb62a3a9b5da77bdd2fcaecdf6be2734b1bf (patch) | |
tree | c30e2f902475a130e28d1c7ad8ed25602ee7a13d /includes/pager.inc | |
parent | eaee909a00a516d864da65e44f8abe5446914c7e (diff) | |
download | brdo-ccd6fb62a3a9b5da77bdd2fcaecdf6be2734b1bf.tar.gz brdo-ccd6fb62a3a9b5da77bdd2fcaecdf6be2734b1bf.tar.bz2 |
#903110 by bojanz: Fixed Multiple pager support is partially broken. (with tests)
Diffstat (limited to 'includes/pager.inc')
-rw-r--r-- | includes/pager.inc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/includes/pager.inc b/includes/pager.inc index 521c1d38a..b6d1e77f4 100644 --- a/includes/pager.inc +++ b/includes/pager.inc @@ -82,16 +82,16 @@ class PagerDefault extends SelectQueryExtender { /** * Ensure that there is an element associated with this query. + * If an element was not specified previously, then the value of the + * $maxElement counter is taken, after which the counter is incremented. * - * After running this query, access $this->element to get the element for this + * After running this method, access $this->element to get the element for this * query. */ protected function ensureElement() { - if (!empty($this->element)) { - return; + if (!isset($this->element)) { + $this->element = self::$maxElement++; } - - $this->element = self::$maxElement++; } /** @@ -149,10 +149,20 @@ class PagerDefault extends SelectQueryExtender { * whatever reason you want to explicitly define an element for a given query, * you may do so here. * + * Setting the element here also increments the static $maxElement counter, + * which is used for determining the $element when there's none specified. + * + * Note that no collision detection is done when setting an element ID + * explicitly, so it is possible for two pagers to end up using the same ID + * if both are set explicitly. + * * @param $element */ public function element($element) { $this->element = $element; + if ($element >= self::$maxElement) { + self::$maxElement = $element + 1; + } return $this; } } |