EntityFieldQuery::pager

public function EntityFieldQuery::pager

public EntityFieldQuery::pager($limit = 10, $element = NULL)

Enables a pager for the query.

Parameters

$limit: An integer specifying the number of elements per page. If passed a false value (FALSE, 0, NULL), the pager is disabled.

$element: An optional integer to distinguish between multiple pagers on one page. If not provided, one is automatically calculated.

Return value

EntityFieldQuery The called object.

File

includes/entity.inc, line 1044

Class

EntityFieldQuery
Retrieves entities matching a given set of conditions.

Code

public function pager($limit = 10, $element = NULL) {
  if (!isset($element)) {
    $element = PagerDefault::$maxElement++;
  }
  elseif ($element >= PagerDefault::$maxElement) {
    PagerDefault::$maxElement = $element + 1;
  }

  $this->pager = array(
    'limit' => $limit,
    'element' => $element,
  );
  return $this;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!entity.inc/function/EntityFieldQuery::pager/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部