1 pager.class.inc public PagerDefault::element($element_id)

Specify the element ID for this pager query.

The element is used to differentiate different pager queries on the same page so that they may be operated independently. If you do not specify an element, every pager query on the page will get a unique element. If for 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.

Parameters

int $element_id: The element ID to set.

Return value

PagerDefault: The current pager object.

File

core/includes/pager.class.inc, line 164

Class

PagerDefault
Query extender for pager queries.

Code

public function element($element_id) {
  $this->element = $element_id;
  if ($element_id >= self::$maxElement) {
    self::$maxElement = $element_id + 1;
  }
  return $this;
}